public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-2523] libstdc++: Optimize is_reference
@ 2022-09-07 14:23 Patrick Palka
  0 siblings, 0 replies; only message in thread
From: Patrick Palka @ 2022-09-07 14:23 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-07 14:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07 14:23 [gcc r13-2523] libstdc++: Optimize is_reference Patrick Palka

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).