]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Optimize std::is_compound compilation performance
authorKen Matsui <kmatsui@gcc.gnu.org>
Tue, 18 Jul 2023 06:47:15 +0000 (23:47 -0700)
committerKen Matsui <kmatsui@gcc.gnu.org>
Thu, 11 Jan 2024 04:08:26 +0000 (20:08 -0800)
This patch optimizes the compilation performance of std::is_compound.

libstdc++-v3/ChangeLog:

* include/std/type_traits (is_compound): Do not use __not_.
(is_compound_v): Use is_fundamental_v instead.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
libstdc++-v3/include/std/type_traits

index 1cec0822b73a5600f71178e6454f92cf754c3879..b6b680a3c5834bcf5c4759fdcc8e819e339f73aa 100644 (file)
@@ -751,7 +751,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// is_compound
   template<typename _Tp>
     struct is_compound
-    : public __not_<is_fundamental<_Tp>>::type { };
+    : public __bool_constant<!is_fundamental<_Tp>::value> { };
 
   /// is_member_pointer
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
@@ -3305,7 +3305,7 @@ template <typename _Tp>
 template <typename _Tp>
   inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
 template <typename _Tp>
-  inline constexpr bool is_compound_v = is_compound<_Tp>::value;
+  inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>;
 
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
 template <typename _Tp>