From: Ken Matsui Date: Thu, 15 Feb 2024 08:49:55 +0000 (-0800) Subject: libstdc++: Optimize std::add_rvalue_reference compilation performance X-Git-Tag: basepoints/gcc-16~8262 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f3eb16743a126ebe6d200ad0091495b6f11962a;p=thirdparty%2Fgcc.git libstdc++: Optimize std::add_rvalue_reference compilation performance This patch optimizes the compilation performance of std::add_rvalue_reference by dispatching to the new __add_rvalue_reference built-in trait. libstdc++-v3/ChangeLog: * include/std/type_traits (__add_rval_ref_t): Use __add_rvalue_reference built-in trait. Signed-off-by: Ken Matsui Reviewed-by: Patrick Palka Reviewed-by: Jonathan Wakely --- diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 79983ea980a..a31de2ee4ab 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1184,6 +1184,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; /// @cond undocumented +#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_rvalue_reference) + template + using __add_rval_ref_t = __add_rvalue_reference(_Tp); +#else template struct __add_rvalue_reference_helper { using type = _Tp; }; @@ -1194,6 +1198,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template using __add_rval_ref_t = typename __add_rvalue_reference_helper<_Tp>::type; +#endif /// @endcond /// is_move_constructible