This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] Optimize add_lvalue_reference/add_rvalue_reference in mainline


Hi,

tested x86_64-linux, committed to mainline.

Paolo.

////////////////////
2009-03-14  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/std/type_traits (__add_lvalue_reference_helper,
	__add_rvalue_reference_helper): As an optimization, rewrite
	condition (avoid is_function).
Index: include/std/type_traits
===================================================================
--- include/std/type_traits	(revision 144866)
+++ include/std/type_traits	(working copy)
@@ -111,7 +111,7 @@
     { typedef _Tp   type; };
 
   template<typename _Tp,
-	   bool = is_object<_Tp>::value || is_function<_Tp>::value,
+	   bool = !is_reference<_Tp>::value && !is_void<_Tp>::value,
 	   bool = is_rvalue_reference<_Tp>::value>
     struct __add_lvalue_reference_helper
     { typedef _Tp   type; };
@@ -131,7 +131,7 @@
     { };
 
   template<typename _Tp,
-	   bool = is_object<_Tp>::value || is_function<_Tp>::value>
+	   bool = !is_reference<_Tp>::value && !is_void<_Tp>::value>
     struct __add_rvalue_reference_helper
     { typedef _Tp   type; };
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]