]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Use __bool_constant entirely
authorKen Matsui <kmatsui@gcc.gnu.org>
Sat, 15 Jul 2023 02:55:35 +0000 (19:55 -0700)
committerKen Matsui <kmatsui@gcc.gnu.org>
Sat, 12 Aug 2023 00:54:45 +0000 (17:54 -0700)
This patch uses __bool_constant entirely instead of integral_constant<bool>
in the type_traits header, specifically for true_type, false_type,
and bool_constant.

libstdc++-v3/ChangeLog:

* include/std/type_traits (true_type): Use __bool_constant
instead.
(false_type): Likewise.
(bool_constant): Likewise.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/include/std/type_traits

index 9f086992ebcc0728658176370e58b7dc0a1ace48..7dc5791a7c5e2a931cdce22fcc011e62bdf363af 100644 (file)
@@ -78,24 +78,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     constexpr _Tp integral_constant<_Tp, __v>::value;
 #endif
 
-  /// The type used as a compile-time boolean with true value.
-  using true_type =  integral_constant<bool, true>;
-
-  /// The type used as a compile-time boolean with false value.
-  using false_type = integral_constant<bool, false>;
-
   /// @cond undocumented
   /// bool_constant for C++11
   template<bool __v>
     using __bool_constant = integral_constant<bool, __v>;
   /// @endcond
 
+  /// The type used as a compile-time boolean with true value.
+  using true_type =  __bool_constant<true>;
+
+  /// The type used as a compile-time boolean with false value.
+  using false_type = __bool_constant<false>;
+
 #if __cplusplus >= 201703L
 # define __cpp_lib_bool_constant 201505L
   /// Alias template for compile-time boolean constant types.
   /// @since C++17
   template<bool __v>
-    using bool_constant = integral_constant<bool, __v>;
+    using bool_constant = __bool_constant<__v>;
 #endif
 
   // Metaprogramming helper types.