aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-07-22 20:40:17 +0100
committerThomas Koenig <tkoenig@gcc.gnu.org>2024-07-28 19:05:56 +0200
commita9273a2991a74421f4627145f520a1eaf37736c7 (patch)
tree077283aac62461182399b7ab16719fd0265f307d /libcpp
parent13c94d827596cb90c53e35e0c6839e10c0944d25 (diff)
downloadgcc-a9273a2991a74421f4627145f520a1eaf37736c7.zip
gcc-a9273a2991a74421f4627145f520a1eaf37736c7.tar.gz
gcc-a9273a2991a74421f4627145f520a1eaf37736c7.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 'libcpp')
0 files changed, 0 insertions, 0 deletions