From: Ken Matsui Date: Thu, 15 Feb 2024 07:22:57 +0000 (-0800) Subject: libstdc++: Optimize std::add_lvalue_reference compilation performance X-Git-Tag: basepoints/gcc-16~8263 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13a07c1420b35ac7649f7d8a776b553ec5c26269;p=thirdparty%2Fgcc.git libstdc++: Optimize std::add_lvalue_reference compilation performance This patch optimizes the compilation performance of std::add_lvalue_reference by dispatching to the new __add_lvalue_reference built-in trait. libstdc++-v3/ChangeLog: * include/std/type_traits (__add_lval_ref_t): Use __add_lvalue_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 0ef11292657..79983ea980a 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1157,6 +1157,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; /// @cond undocumented +#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_lvalue_reference) + template + using __add_lval_ref_t = __add_lvalue_reference(_Tp); +#else template struct __add_lvalue_reference_helper { using type = _Tp; }; @@ -1167,6 +1171,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template using __add_lval_ref_t = typename __add_lvalue_reference_helper<_Tp>::type; +#endif /// @endcond /// is_copy_constructible