Skip to content

Commit

Permalink
libstdc++: Optimize is_unbounded_array trait performance
Browse files Browse the repository at this point in the history
This patch optimizes the performance of the is_unbounded_array trait 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>
  • Loading branch information
ken-matsui authored and ouuleilei-bot committed Sep 14, 2023
1 parent 687eecf commit 2e6280d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libstdc++-v3/include/std/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -3533,11 +3533,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
Expand Down

0 comments on commit 2e6280d

Please sign in to comment.