]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/ChangeLog
Fix std::visit to support arbitrary callables
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Apr 2019 18:50:43 +0000 (18:50 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Apr 2019 18:50:43 +0000 (18:50 +0000)
commit47cf9c4c65d0b7a831dddf92126dd7fc2b05bc2b
tree0bd9c3d6f3251d67f4acf2bfbdd6917989e32da5
parentfaa382bd3567b6c8ffb01bab096e86882aa576b5
Fix std::visit to support arbitrary callables

The __visitor_result_type helper didn't use std::invoke and so didn't
compile when the visitor was a pointer-to-member rather than a function
object. Use std::invoke_result instead.

* include/std/variant (__variant_idx_cookie): Add member type.
(__visitor_result_type): Remove.
(__do_visit): Use invoke_result instead of __visitor_result_type.
* testsuite/20_util/variant/visit.cc: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@270237 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/variant
libstdc++-v3/testsuite/20_util/variant/visit.cc [new file with mode: 0644]