aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Matsui <kmatsui@gcc.gnu.org>2024-02-15 04:44:54 -0800
committerKen Matsui <kmatsui@gcc.gnu.org>2024-06-13 05:56:36 -0700
commit9d0dba02c5452d5906f87e59455a4c38944eb217 (patch)
treef006b9a3529bbd15494493ee02354bd64c9ea338
parent66f5bebd126657ec4b430fa9bc4b8557485f469d (diff)
downloadgcc-9d0dba02c5452d5906f87e59455a4c38944eb217.zip
gcc-9d0dba02c5452d5906f87e59455a4c38944eb217.tar.gz
gcc-9d0dba02c5452d5906f87e59455a4c38944eb217.tar.bz2
libstdc++: Optimize std::decay compilation performance
This patch optimizes the compilation performance of std::decay by dispatching to the new __decay built-in trait. libstdc++-v3/ChangeLog: * include/std/type_traits (decay): Use __decay built-in trait. Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org> Reviewed-by: Patrick Palka <ppalka@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
-rw-r--r--libstdc++-v3/include/std/type_traits6
1 files changed, 6 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 23432ac..3d158f9 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -2278,6 +2278,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// @cond undocumented
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__decay)
+ template<typename _Tp>
+ struct decay
+ { using type = __decay(_Tp); };
+#else
// Decay trait for arrays and functions, used for perfect forwarding
// in make_pair, make_tuple, etc.
template<typename _Up>
@@ -2309,6 +2314,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp>
struct decay<_Tp&&>
{ using type = typename __decay_selector<_Tp>::type; };
+#endif
/// @cond undocumented