aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-10-19 11:06:56 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-10-19 15:01:16 +0100
commit82b2e4f8cf5a01c6724fe3f465a77ee03cfcaae2 (patch)
treeebc6317967464146890f1a47aae196445dd0bb31 /gcc/tree-vectorizer.h
parent6920d5a1a2834e9c62d441b8f4c6186b01107d13 (diff)
downloadgcc-82b2e4f8cf5a01c6724fe3f465a77ee03cfcaae2.zip
gcc-82b2e4f8cf5a01c6724fe3f465a77ee03cfcaae2.tar.gz
gcc-82b2e4f8cf5a01c6724fe3f465a77ee03cfcaae2.tar.bz2
libstdc++: Implement monadic operations for std::optional (P0798R8)
Another new addition to the C++23 working draft. The new member functions of std::optional are only defined for C++23, but the new members of _Optional_payload_base are defined for C++20 so that they can be used in non-propagating-cache in <ranges>. The _Optional_payload_base::_M_construct member can also be used in non-propagating-cache now, because it's constexpr since r12-4389. There will be an LWG issue about the feature test macro, suggesting that we should just bump the value of __cpp_lib_optional instead. I haven't done that here, but it can be changed once consensus is reached on the change. libstdc++-v3/ChangeLog: * include/std/optional (_Optional_payload_base::_Storage): Add constructor taking a callable function to invoke. (_Optional_payload_base::_M_apply): New function. (__cpp_lib_monadic_optional): Define for C++23. (optional::and_then, optional::transform, optional::or_else): Define for C++23. * include/std/ranges (__detail::__cached): Remove. (__detail::__non_propagating_cache): Remove use of __cached for contained value. Use _Optional_payload_base::_M_construct and _Optional_payload_base::_M_apply to set the contained value. * include/std/version (__cpp_lib_monadic_optional): Define. * testsuite/20_util/optional/monadic/and_then.cc: New test. * testsuite/20_util/optional/monadic/or_else.cc: New test. * testsuite/20_util/optional/monadic/or_else_neg.cc: New test. * testsuite/20_util/optional/monadic/transform.cc: New test. * testsuite/20_util/optional/monadic/version.cc: New test.
Diffstat (limited to 'gcc/tree-vectorizer.h')
0 files changed, 0 insertions, 0 deletions