]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Optimize std::remove_extent compilation performance
authorKen Matsui <kmatsui@gcc.gnu.org>
Wed, 14 Feb 2024 13:50:49 +0000 (05:50 -0800)
committerKen Matsui <kmatsui@gcc.gnu.org>
Thu, 13 Jun 2024 12:56:18 +0000 (05:56 -0700)
This patch optimizes the compilation performance of std::remove_extent
by dispatching to the new __remove_extent built-in trait.

libstdc++-v3/ChangeLog:

* include/std/type_traits (remove_extent): Use __remove_extent
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 e179015be9342914b78b49cc49069fc3cb4d6ed5..02d7a3e50171b62d65d434e0d582398ce38e2258 100644 (file)
@@ -2078,6 +2078,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // Array modifications.
 
   /// remove_extent
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_extent)
+  template<typename _Tp>
+    struct remove_extent
+    { using type = __remove_extent(_Tp); };
+#else
   template<typename _Tp>
     struct remove_extent
     { using type = _Tp; };
@@ -2089,6 +2094,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _Tp>
     struct remove_extent<_Tp[]>
     { using type = _Tp; };
+#endif
 
   /// remove_all_extents
   template<typename _Tp>