public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Use built-ins for more variable templates
Date: Mon,  5 Sep 2022 16:44:22 +0100	[thread overview]
Message-ID: <20220905154422.663502-1-jwakely@redhat.com> (raw)

Tested powerpc64le-linux, pushed to trunk.

-- >8 --

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_trivial_v, is_trivially_copyable_v)
	(is_standard_layout_v, is_pod_v, is_literal_type_v): Use
	built-in instead of class template.
	(is_same_v): Add partial specialization for true case.
---
 libstdc++-v3/include/std/type_traits | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index c7a96079ebf..e19d964fa9c 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -3077,22 +3077,19 @@ template <typename _Tp>
   inline constexpr bool is_volatile_v = false;
 template <typename _Tp>
   inline constexpr bool is_volatile_v<volatile _Tp> = true;
+
 template <typename _Tp>
-  inline constexpr bool is_trivial_v = is_trivial<_Tp>::value;
+  inline constexpr bool is_trivial_v = __is_trivial(_Tp);
 template <typename _Tp>
-  inline constexpr bool is_trivially_copyable_v =
-    is_trivially_copyable<_Tp>::value;
+  inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp);
 template <typename _Tp>
-  inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+  inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp);
 template <typename _Tp>
   _GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead")
-  inline constexpr bool is_pod_v = is_pod<_Tp>::value;
+  inline constexpr bool is_pod_v = __is_pod(_Tp);
 template <typename _Tp>
   _GLIBCXX17_DEPRECATED
-  inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
-#pragma GCC diagnostic pop
+  inline constexpr bool is_literal_type_v = __is_literal_type(_Tp);
 template <typename _Tp>
   inline constexpr bool is_empty_v = __is_empty(_Tp);
 template <typename _Tp>
@@ -3101,6 +3098,7 @@ template <typename _Tp>
   inline constexpr bool is_abstract_v = __is_abstract(_Tp);
 template <typename _Tp>
   inline constexpr bool is_final_v = __is_final(_Tp);
+
 template <typename _Tp>
   inline constexpr bool is_signed_v = is_signed<_Tp>::value;
 template <typename _Tp>
@@ -3183,9 +3181,11 @@ template <typename _Tp>
 template <typename _Tp>
   inline constexpr bool is_nothrow_destructible_v =
     is_nothrow_destructible<_Tp>::value;
+
 template <typename _Tp>
-  inline constexpr bool has_virtual_destructor_v =
-    has_virtual_destructor<_Tp>::value;
+  inline constexpr bool has_virtual_destructor_v
+    = __has_virtual_destructor(_Tp);
+
 template <typename _Tp>
   inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
 
@@ -3212,7 +3212,9 @@ template <typename _Tp, typename _Up>
   inline constexpr bool is_same_v = __is_same(_Tp, _Up);
 #else
 template <typename _Tp, typename _Up>
-  inline constexpr bool is_same_v = std::is_same<_Tp, _Up>::value;
+  inline constexpr bool is_same_v = false;
+template <typename _Tp>
+  inline constexpr bool is_same_v<_Tp, _Tp> = true;
 #endif
 template <typename _Base, typename _Derived>
   inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived);
-- 
2.37.3


                 reply	other threads:[~2022-09-05 15:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220905154422.663502-1-jwakely@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).