]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Optimize std::remove_all_extents compilation performance
authorKen Matsui <kmatsui@gcc.gnu.org>
Thu, 15 Feb 2024 06:47:05 +0000 (22:47 -0800)
committerKen Matsui <kmatsui@gcc.gnu.org>
Thu, 13 Jun 2024 12:56:28 +0000 (05:56 -0700)
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 <kmatsui@gcc.gnu.org>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/include/std/type_traits

index 02d7a3e50171b62d65d434e0d582398ce38e2258..23432ac43ac6bd90a90af9fa7465d3f0c7a3dde6 100644 (file)
@@ -2097,6 +2097,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
 
   /// remove_all_extents
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_all_extents)
+  template<typename _Tp>
+    struct remove_all_extents
+    { using type = __remove_all_extents(_Tp); };
+#else
   template<typename _Tp>
     struct remove_all_extents
     { using type = _Tp; };
@@ -2108,6 +2113,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _Tp>
     struct remove_all_extents<_Tp[]>
     { using type = typename remove_all_extents<_Tp>::type; };
+#endif
 
 #if __cplusplus > 201103L
   /// Alias template for remove_extent