Changed constraints on pair and tuple constructors from is_convertible to is_constructible.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134252 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2011-07-01 20:12:51 +00:00
parent 61aa6013c3
commit 74248888ab
2 changed files with 6 additions and 10 deletions

View File

@ -214,11 +214,7 @@ struct __tuple_convertible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up> template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> > struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool, : public integral_constant<bool,
#if 1 // waiting on cwg 1170
is_convertible<_Tp0, _Up0>::value &&
#else
is_constructible<_Up0, _Tp0>::value && is_constructible<_Up0, _Tp0>::value &&
#endif
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {}; __tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <> template <>

View File

@ -227,8 +227,8 @@ struct _LIBCPP_VISIBLE pair
template<class _U1, class _U2> template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair(const pair<_U1, _U2>& __p, pair(const pair<_U1, _U2>& __p,
typename enable_if<is_convertible<_U1, _T1>::value && typename enable_if<is_constructible<_T1, _U1>::value &&
is_convertible<_U2, _T2>::value>::type* = 0) is_constructible<_T2, _U2>::value>::type* = 0)
: first(__p.first), second(__p.second) {} : first(__p.first), second(__p.second) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@ -253,8 +253,8 @@ struct _LIBCPP_VISIBLE pair
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _U1, class _U2, template <class _U1, class _U2,
class = typename enable_if<is_convertible<_U1, first_type >::value && class = typename enable_if<is_constructible<first_type, _U1 >::value &&
is_convertible<_U2, second_type>::value>::type> is_constructible<second_type, _U2>::value>::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair(_U1&& __u1, _U2&& __u2) pair(_U1&& __u1, _U2&& __u2)
: first(_VSTD::forward<_U1>(__u1)), : first(_VSTD::forward<_U1>(__u1)),
@ -264,8 +264,8 @@ struct _LIBCPP_VISIBLE pair
template<class _U1, class _U2> template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair(pair<_U1, _U2>&& __p, pair(pair<_U1, _U2>&& __p,
typename enable_if<is_convertible<_U1, _T1>::value && typename enable_if<is_constructible<_T1, _U1>::value &&
is_convertible<_U2, _T2>::value>::type* = 0) is_constructible<_T2, _U2>::value>::type* = 0)
: first(_VSTD::forward<_U1>(__p.first)), : first(_VSTD::forward<_U1>(__p.first)),
second(_VSTD::forward<_U2>(__p.second)) {} second(_VSTD::forward<_U2>(__p.second)) {}