]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/include/std/type_traits
libstdc++: Simplify detection idiom using concepts
authorJonathan Wakely <jwakely@redhat.com>
Fri, 23 Sep 2022 22:16:30 +0000 (23:16 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 24 Sep 2022 14:18:11 +0000 (15:18 +0100)
commit2b667beba693e876322af7c6682f9bc885c5ec28
tree9e72c426022758ff0c98a38fda2a510b647d3d62
parentad2aab5c816a6fd56b46210c0a4a4c6243da1de9
libstdc++: Simplify detection idiom using concepts

Add a simpler definition of std::__detected_or using concepts.  This
also replaces the __detector::value_t member which should have been using
a reserved name.

Use __detected_or in pointer_traits.

libstdc++-v3/ChangeLog:

* include/bits/alloc_traits.h (allocator_traits::is_always_equal):
Only instantiate is_empty if needed.
* include/bits/ptr_traits.h (__ptr_traits_impl::difference_type)
(__ptr_traits_impl::rebind): Use __detected_or.
* include/experimental/type_traits (is_same_v): Add a partial
specialization instead of instantiating the std::is_same class
template.
(detected_t): Redefine in terms of detected_or_t.
(is_detected, is_detected_v): Redefine in terms of detected_t.
* include/std/type_traits [__cpp_concepts] (__detected_or): Add
new definition using concepts.
(__detector::value_t): Rename to __is_detected.
* testsuite/17_intro/names.cc: Check value_t isn't used.
libstdc++-v3/include/bits/alloc_traits.h
libstdc++-v3/include/bits/ptr_traits.h
libstdc++-v3/include/experimental/type_traits
libstdc++-v3/include/std/type_traits
libstdc++-v3/testsuite/17_intro/names.cc