summaryrefslogtreecommitdiffstats
path: root/libcxx/include
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-04-19 01:19:25 +0000
committerEric Fiselier <eric@efcs.ca>2016-04-19 01:19:25 +0000
commit9795699a7282a29d1a0a5c202209c6e2a4cc5539 (patch)
tree8a0a829dc3e86541e2bd74b35b316bed3c1e62f1 /libcxx/include
parent167c7962321f063a713957296e37e5b1903cf007 (diff)
downloadbcm5719-llvm-9795699a7282a29d1a0a5c202209c6e2a4cc5539.tar.gz
bcm5719-llvm-9795699a7282a29d1a0a5c202209c6e2a4cc5539.zip
Make tuples constructors conditionally EXPLICIT. See N4387
llvm-svn: 266703
Diffstat (limited to 'libcxx/include')
-rw-r--r--libcxx/include/tuple109
1 files changed, 100 insertions, 9 deletions
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 6a65aba455b..73f42a0403c 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -449,7 +449,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
template <class _Alloc, class _Tuple,
class = typename enable_if
<
- __tuple_convertible<_Tuple, tuple<_Tp...> >::value
+ __tuple_constructible<_Tuple, tuple<_Tp...> >::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
@@ -673,8 +673,17 @@ public:
typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
__tuple_types<_Tp...>()) {}
+ template <bool _Dummy = true,
+ typename enable_if
+ <
+ _CheckArgsConstructor<
+ _Dummy
+ >::template __enable_implicit<_Tp...>(),
+ bool
+ >::type = false
+ >
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
- explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value))
+ tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value))
: base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
typename __make_tuple_indices<0>::type(),
@@ -682,7 +691,33 @@ public:
__t...
) {}
- template <class _Alloc>
+ template <bool _Dummy = true,
+ typename enable_if
+ <
+ _CheckArgsConstructor<
+ _Dummy
+ >::template __enable_explicit<_Tp...>(),
+ bool
+ >::type = false
+ >
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+ explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value))
+ : base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
+ typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
+ typename __make_tuple_indices<0>::type(),
+ typename __make_tuple_types<tuple, 0>::type(),
+ __t...
+ ) {}
+
+ template <class _Alloc, bool _Dummy = true,
+ typename enable_if
+ <
+ _CheckArgsConstructor<
+ _Dummy
+ >::template __enable_implicit<_Tp...>(),
+ bool
+ >::type = false
+ >
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)
: base_(allocator_arg_t(), __a,
@@ -693,6 +728,26 @@ public:
__t...
) {}
+ template <class _Alloc, bool _Dummy = true,
+ typename enable_if
+ <
+ _CheckArgsConstructor<
+ _Dummy
+ >::template __enable_explicit<_Tp...>(),
+ bool
+ >::type = false
+ >
+ _LIBCPP_INLINE_VISIBILITY
+ explicit
+ tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)
+ : base_(allocator_arg_t(), __a,
+ typename __make_tuple_indices<sizeof...(_Tp)>::type(),
+ typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
+ typename __make_tuple_indices<0>::type(),
+ typename __make_tuple_types<tuple, 0>::type(),
+ __t...
+ ) {}
+
template <class ..._Up,
typename enable_if
<
@@ -749,13 +804,14 @@ public:
_VSTD::forward<_Up>(__u)...) {}
template <class _Alloc, class ..._Up,
- class = typename enable_if
+ typename enable_if
<
_CheckArgsConstructor<
sizeof...(_Up) == sizeof...(_Tp) &&
!_PackExpandsToThisTuple<_Up...>::value
- >::template __enable_implicit<_Up...>()
- >::type
+ >::template __enable_implicit<_Up...>(),
+ bool
+ >::type = false
>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
@@ -766,6 +822,26 @@ public:
typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
_VSTD::forward<_Up>(__u)...) {}
+ template <class _Alloc, class ..._Up,
+ typename enable_if
+ <
+ _CheckArgsConstructor<
+ sizeof...(_Up) == sizeof...(_Tp) &&
+ !_PackExpandsToThisTuple<_Up...>::value
+ >::template __enable_explicit<_Up...>(),
+ bool
+ >::type = false
+ >
+ _LIBCPP_INLINE_VISIBILITY
+ explicit
+ tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
+ : base_(allocator_arg_t(), __a,
+ typename __make_tuple_indices<sizeof...(_Up)>::type(),
+ typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
+ typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
+ typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
+ _VSTD::forward<_Up>(__u)...) {}
+
template <class _Tuple,
typename enable_if
<
@@ -796,17 +872,32 @@ public:
: base_(_VSTD::forward<_Tuple>(__t)) {}
template <class _Alloc, class _Tuple,
- class = typename enable_if
+ typename enable_if
<
_CheckTupleLikeConstructor<
__tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value
- >::template __enable_implicit<_Tuple>()
- >::type
+ >::template __enable_implicit<_Tuple>(),
+ bool
+ >::type = false
>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
: base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {}
+ template <class _Alloc, class _Tuple,
+ typename enable_if
+ <
+ _CheckTupleLikeConstructor<
+ __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value
+ >::template __enable_explicit<_Tuple>(),
+ bool
+ >::type = false
+ >
+ _LIBCPP_INLINE_VISIBILITY
+ explicit
+ tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
+ : base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {}
+
template <class _Tuple,
class = typename enable_if
<
OpenPOWER on IntegriCloud