public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Use __bool_constant entirely
@ 2023-07-15  3:01 Ken Matsui
  2023-08-08 20:07 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Ken Matsui @ 2023-07-15  3:01 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

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>
---
 libstdc++-v3/include/std/type_traits | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 9f086992ebc..7dc5791a7c5 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -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.
-- 
2.41.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libstdc++: Use __bool_constant entirely
  2023-07-15  3:01 [PATCH] libstdc++: Use __bool_constant entirely Ken Matsui
@ 2023-08-08 20:07 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2023-08-08 20:07 UTC (permalink / raw)
  To: Ken Matsui; +Cc: gcc-patches, libstdc++

[-- Attachment #1: Type: text/plain, Size: 2061 bytes --]

On Sat, 15 Jul 2023 at 04:02, Ken Matsui via Libstdc++ <
libstdc++@gcc.gnu.org> wrote:

> 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>
> ---
>  libstdc++-v3/include/std/type_traits | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/libstdc++-v3/include/std/type_traits
> b/libstdc++-v3/include/std/type_traits
> index 9f086992ebc..7dc5791a7c5 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -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.
>
>
This seems a bit pointless IMHO, but I suppose it makes things more
consistent.

OK for trunk.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-08 20:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-15  3:01 [PATCH] libstdc++: Use __bool_constant entirely Ken Matsui
2023-08-08 20:07 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).