Skip to content

Commit

Permalink
libstdc++: Optimize std::is_bounded_array compilation performance
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ken-matsui authored and ouuleilei-bot committed Dec 12, 2023
1 parent 49e1f02 commit ab1988a
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 @@ -3498,11 +3498,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
Expand Down

0 comments on commit ab1988a

Please sign in to comment.