[cfe-commits] [libcxx] r130521 - /libcxx/trunk/include/utility

Howard Hinnant hhinnant at apple.com
Fri Apr 29 11:10:55 PDT 2011


Author: hhinnant
Date: Fri Apr 29 13:10:55 2011
New Revision: 130521

URL: http://llvm.org/viewvc/llvm-project?rev=130521&view=rev
Log:
Correction to set of overloaded pair constructors for C++0x

Modified:
    libcxx/trunk/include/utility

Modified: libcxx/trunk/include/utility
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=130521&r1=130520&r2=130521&view=diff
==============================================================================
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Fri Apr 29 13:10:55 2011
@@ -211,6 +211,13 @@
     _LIBCPP_INLINE_VISIBILITY pair(const _T1& __x, const _T2& __y)
         : first(__x), second(__y) {}
 
+    template<class _U1, class _U2>
+        _LIBCPP_INLINE_VISIBILITY
+        pair(const pair<_U1, _U2>& __p,
+                 typename enable_if<is_convertible<_U1, _T1>::value &&
+                                    is_convertible<_U2, _T2>::value>::type* = 0)
+            : first(__p.first), second(__p.second) {}
+
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
     template <class _U1, class _U2,
@@ -222,6 +229,14 @@
               second(_STD::forward<_U2>(__u2))
             {}
 
+    template<class _U1, class _U2>
+        _LIBCPP_INLINE_VISIBILITY
+        pair(pair<_U1, _U2>&& __p,
+                 typename enable_if<is_convertible<_U1, _T1>::value &&
+                                    is_convertible<_U2, _T2>::value>::type* = 0)
+            : first(_STD::forward<_U1>(__p.first)),
+              second(_STD::forward<_U2>(__p.second)) {}
+
 #ifndef _LIBCPP_HAS_NO_VARIADICS
 
     template<class _Tuple,
@@ -261,10 +276,6 @@
 
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
-#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    template<class _U1, class _U2>
-        _LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p)
-            : first(__p.first), second(__p.second) {}
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     void _LIBCPP_INLINE_VISIBILITY swap(pair& __p) {_STD::swap(*this, __p);}
 private:





More information about the cfe-commits mailing list