]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Optimize std::is_unbounded_array compilation performance
authorKen Matsui <kmatsui@gcc.gnu.org>
Mon, 11 Sep 2023 20:58:35 +0000 (13:58 -0700)
committerKen Matsui <kmatsui@gcc.gnu.org>
Thu, 13 Jun 2024 12:55:57 +0000 (05:55 -0700)
This patch optimizes the compilation performance of
std::is_unbounded_array by dispatching to the new
__is_unbounded_array built-in trait.

libstdc++-v3/ChangeLog:

* include/std/type_traits (is_unbounded_array_v): Use
__is_unbounded_array 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 748fa186881df6983065cae60faa538e006ff0d9..efbe273d38a9b0efa1474b78b2adf41377e5d182 100644 (file)
@@ -3682,11 +3682,16 @@ template<typename _Ret, typename _Fn, typename... _Args>
   /// True for a type that is an array of unknown bound.
   /// @ingroup variable_templates
   /// @since C++20
+# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unbounded_array)
+  template<typename _Tp>
+    inline constexpr bool is_unbounded_array_v = __is_unbounded_array(_Tp);
+# else
   template<typename _Tp>
     inline constexpr bool is_unbounded_array_v = false;
 
   template<typename _Tp>
     inline constexpr bool is_unbounded_array_v<_Tp[]> = true;
+# endif
 
   /// True for a type that is an array of known bound.
   /// @since C++20