diff mbox series

[v26,04/13] libstdc++: Optimize std::is_unbounded_array compilation performance

Message ID 20240511090130.248174-4-kmatsui@gcc.gnu.org
State New
Headers show
Series [v26,01/13] libstdc++: Optimize std::is_const compilation performance | expand

Commit Message

Ken Matsui May 11, 2024, 9:01 a.m. UTC
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>
---
 libstdc++-v3/include/std/type_traits | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jonathan Wakely June 13, 2024, 12:32 p.m. UTC | #1
On 11/05/24 02:01 -0700, Ken Matsui wrote:
>This patch optimizes the compilation performance of
>std::is_unbounded_array by dispatching to the new
>__is_unbounded_array built-in trait.

OK, thanks.

>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>
>---
> libstdc++-v3/include/std/type_traits | 5 +++++
> 1 file changed, 5 insertions(+)
>
>diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
>index ea013b4b7bc..1562757f886 100644
>--- a/libstdc++-v3/include/std/type_traits
>+++ b/libstdc++-v3/include/std/type_traits
>@@ -3710,11 +3710,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
>-- 
>2.44.0
>
diff mbox series

Patch

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index ea013b4b7bc..1562757f886 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -3710,11 +3710,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