]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Optimize std::is_bounded_array compilation performance
authorKen Matsui <kmatsui@gcc.gnu.org>
Tue, 12 Sep 2023 02:15:21 +0000 (19:15 -0700)
committerKen Matsui <kmatsui@gcc.gnu.org>
Sat, 16 Dec 2023 16:59:31 +0000 (08:59 -0800)
This patch optimizes the compilation performance of std::is_bounded_array
by dispatching to the new __is_bounded_array built-in trait.

libstdc++-v3/ChangeLog:

* include/std/type_traits (is_bounded_array_v): Use
__is_bounded_array built-in trait.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/include/std/type_traits

index 64f9d67fe29894b1f8d294b3fb682bddba5edf07..2a1a0aa80ffdc971e8f5fe5aad7c7f6eb9aea6e0 100644 (file)
@@ -3506,11 +3506,16 @@ template<typename _Ret, typename _Fn, typename... _Args>
   /// True for a type that is an array of known bound.
   /// @ingroup variable_templates
   /// @since C++20
+# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_bounded_array)
+  template<typename _Tp>
+    inline constexpr bool is_bounded_array_v = __is_bounded_array(_Tp);
+# else
   template<typename _Tp>
     inline constexpr bool is_bounded_array_v = false;
 
   template<typename _Tp, size_t _Size>
     inline constexpr bool is_bounded_array_v<_Tp[_Size]> = true;
+# endif
 
   /// True for a type that is an array of unknown bound.
   /// @ingroup variable_templates