]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/include/std/type_traits
libstdc++: Remove __is_referenceable helper
authorJonathan Wakely <jwakely@redhat.com>
Thu, 1 Sep 2022 14:58:34 +0000 (15:58 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 1 Sep 2022 19:31:00 +0000 (20:31 +0100)
commit56bb34e3d2c800a7f13e65755bccfb6b2dc5e898
tree00788776279deed5796e608402d5aecae9b814be
parent9bcedbbfc510e79cd299001dd79756ee4173b411
libstdc++: Remove __is_referenceable helper

We only use the __is_referenceable helper in three places now:
add_pointer, add_lvalue_reference, and add_rvalue_reference. But lots of
other traits depend on add_[lr]value_reference, and decay depends on
add_pointer, so removing the instantiation of __is_referenceable helps
compile all those other traits slightly faster.

We can just use void_t<T&> to check for a referenceable type in the
add_[lr]value_reference traits.

Then we can specialize add_pointer for reference types, so that we don't
need to use remove_reference, and then use void_t<T*> for all
non-reference types to detect when we can form a pointer to the type.

libstdc++-v3/ChangeLog:

* include/std/type_traits (__is_referenceable): Remove.
(__add_lvalue_reference_helper, __add_rvalue_reference_helper):
Use __void_t instead of __is_referenceable.
(__add_pointer_helper): Likewise.
(add_pointer): Add partial specializations for reference types.
libstdc++-v3/include/std/type_traits