[cfe-commits] [libcxx] r110805 - /libcxx/trunk/include/type_traits
Howard Hinnant
hhinnant at apple.com
Wed Aug 11 07:05:55 PDT 2010
Author: hhinnant
Date: Wed Aug 11 09:05:55 2010
New Revision: 110805
URL: http://llvm.org/viewvc/llvm-project?rev=110805&view=rev
Log:
Modified the definition of std::foward to address National Body Comment US 90
Modified:
libcxx/trunk/include/type_traits
Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=110805&r1=110804&r2=110805&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Wed Aug 11 09:05:55 2010
@@ -1140,20 +1140,50 @@
return static_cast<typename remove_reference<_Tp>::type&&>(__t);
}
-template <class _Tp, class _Up,
- class = typename _STD::enable_if<
- is_lvalue_reference<_Tp>::value ? is_lvalue_reference<_Up>::value : true
- >::type,
- class = typename _STD::enable_if<
- is_convertible<typename remove_reference<_Up>::type*,
- typename remove_reference<_Tp>::type*>::value>::type>
+template <class _Tp,
+ class = typename enable_if<
+ !is_lvalue_reference<_Tp>::value
+ >::type
+ >
inline _LIBCPP_INLINE_VISIBILITY
_Tp&&
-forward(_Up&& __t)
+forward(typename common_type<_Tp>::type& __t)
{
return static_cast<_Tp&&>(__t);
}
+template <class _Tp,
+ class = typename enable_if<
+ !is_lvalue_reference<_Tp>::value
+ >::type
+ >
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp&&
+forward(typename common_type<_Tp>::type&& __t)
+{
+ return static_cast<_Tp&&>(__t);
+}
+
+template <class _Tp,
+ class = typename enable_if<
+ is_lvalue_reference<_Tp>::value
+ >::type
+ >
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+forward(typename common_type<_Tp>::type __t)
+{
+ return __t;
+}
+
+template <class _Tp,
+ class = typename enable_if<
+ is_lvalue_reference<_Tp>::value
+ >::type
+ >
+_Tp
+forward(typename remove_reference<_Tp>::type&& __t) = delete;
+
#else // _LIBCPP_MOVE
template <class _Tp>
More information about the cfe-commits
mailing list