aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-07-22 20:40:17 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2024-07-25 11:53:06 +0100
commit9ed070220ec1c837149f7b2eff7227f2e6b503e3 (patch)
treeb69264bbd9cefa5e751d7f095f3c02928553e00b /gcc
parent4b55cd211f33200b3c25afe138853351ce4ac4d3 (diff)
downloadgcc-9ed070220ec1c837149f7b2eff7227f2e6b503e3.zip
gcc-9ed070220ec1c837149f7b2eff7227f2e6b503e3.tar.gz
gcc-9ed070220ec1c837149f7b2eff7227f2e6b503e3.tar.bz2
libstdc++: Use concepts to simplify std::optional base classes
In C++20 mode we can simplify some of the std::optional base class hierarchy using concepts. We can overload the destructor and copy constructor and move constructor with a trivial defaulted version and a constrained non-trivial version. This allows us to remove some class template partial specializations that were used to conditionally define those special members as trivial or non-trivial. This should not change any semantics, but should be less work for the compiler, due to not needing to match partial specializations, and completely removing one level of the inheritance hierarchy. libstdc++-v3/ChangeLog: * include/std/optional (_Optional_payload_base::_Storage) [C++20]: Define constrained non-trivial destructor. (_Optional_payload_base::_Storage<U, false>) [C++20]: Do not define partial specialization when primary template has constrained destructor. (_Optional_base) [C++20]: Define constrained trivial copy and move cons and move constructors. Define payload accessors here instead of inheriting them from _Optional_base_impl. (_Optional_base_impl, _Optional_base<T, false, true>) (_Optional_base<T, true, false>, _Optional_base<T, true, true>) [C++20]: Do not define.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions