aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Matsui <kmatsui@gcc.gnu.org>2023-09-11 19:15:21 -0700
committerKen Matsui <kmatsui@gcc.gnu.org>2023-12-16 08:59:31 -0800
commit8843cff6c98cb0789a1ec6f51be6c5122fc1b5e9 (patch)
treed9700f67cf83cfd5c46f9850f6cbd56457a69d99
parent7fd9c349e455345a8b94d8fcee1c92b5c92873a5 (diff)
downloadgcc-8843cff6c98cb0789a1ec6f51be6c5122fc1b5e9.zip
gcc-8843cff6c98cb0789a1ec6f51be6c5122fc1b5e9.tar.gz
gcc-8843cff6c98cb0789a1ec6f51be6c5122fc1b5e9.tar.bz2
libstdc++: Optimize std::is_bounded_array compilation performance
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>
-rw-r--r--libstdc++-v3/include/std/type_traits5
1 files changed, 5 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 64f9d67..2a1a0aa 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -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