From: Ken Matsui Date: Thu, 15 Feb 2024 06:47:05 +0000 (-0800) Subject: libstdc++: Optimize std::remove_all_extents compilation performance X-Git-Tag: basepoints/gcc-16~8303 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66f5bebd126657ec4b430fa9bc4b8557485f469d;p=thirdparty%2Fgcc.git libstdc++: Optimize std::remove_all_extents compilation performance This patch optimizes the compilation performance of std::remove_all_extents by dispatching to the new __remove_all_extents built-in trait. libstdc++-v3/ChangeLog: * include/std/type_traits (remove_all_extents): Use __remove_all_extents 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 02d7a3e5017..23432ac43ac 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -2097,6 +2097,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif /// remove_all_extents +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_all_extents) + template + struct remove_all_extents + { using type = __remove_all_extents(_Tp); }; +#else template struct remove_all_extents { using type = _Tp; }; @@ -2108,6 +2113,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct remove_all_extents<_Tp[]> { using type = typename remove_all_extents<_Tp>::type; }; +#endif #if __cplusplus > 201103L /// Alias template for remove_extent