public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r13-2523] libstdc++: Optimize is_reference
Date: Wed,  7 Sep 2022 14:23:15 +0000 (GMT)	[thread overview]
Message-ID: <20220907142315.956F9384D193@sourceware.org> (raw)

https://gcc.gnu.org/g:cdcc27c1ca9c485c66ac1914e352c79e5048b6b5

commit r13-2523-gcdcc27c1ca9c485c66ac1914e352c79e5048b6b5
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Sep 7 10:21:51 2022 -0400

    libstdc++: Optimize is_reference
    
    Instead of defining is_reference in terms of is_[lr]value_reference,
    just define it directly.
    
    libstdc++-v3/ChangeLog:
    
            * include/std/type_traits (is_reference): Make the primary
            template derive from false_type.  Define two partial
            specializations that derive from true_type.

Diff:
---
 libstdc++-v3/include/std/type_traits | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index b83e7257a9f..94e73eafd2f 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -611,8 +611,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// is_reference
   template<typename _Tp>
     struct is_reference
-    : public __or_<is_lvalue_reference<_Tp>,
-                   is_rvalue_reference<_Tp>>::type
+    : public false_type
+    { };
+
+  template<typename _Tp>
+    struct is_reference<_Tp&>
+    : public true_type
+    { };
+
+  template<typename _Tp>
+    struct is_reference<_Tp&&>
+    : public true_type
     { };
 
   /// is_arithmetic

                 reply	other threads:[~2022-09-07 14:23 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=20220907142315.956F9384D193@sourceware.org \
    --to=ppalka@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@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).