diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-07-25 02:36:42 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-07-25 02:36:42 +0000 |
commit | aedcbf898b7136b3aa09f236240eb5f1f05e4b78 (patch) | |
tree | b0e946a2c4b31f6034f4d07023468d4482040a94 /libcxx/include/tuple | |
parent | 68623a0e9fbebfb2aa2edab710d021b26f3f1edf (diff) | |
download | bcm5719-llvm-aedcbf898b7136b3aa09f236240eb5f1f05e4b78.tar.gz bcm5719-llvm-aedcbf898b7136b3aa09f236240eb5f1f05e4b78.zip |
Recommit r276548 - Make pair/tuples assignment operators SFINAE properly.
I think I've solved issues with is_assignable and references to incomplete
types. The updated patch adds tests for this case.
llvm-svn: 276603
Diffstat (limited to 'libcxx/include/tuple')
-rw-r--r-- | libcxx/include/tuple | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libcxx/include/tuple b/libcxx/include/tuple index 31613d2b94f..a68f115b68c 100644 --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -647,6 +647,9 @@ public: _LIBCPP_CONSTEXPR tuple() _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} + tuple(tuple const&) = default; + tuple(tuple&&) = default; + template <class _AllocArgT, class _Alloc, bool _Dummy = true, class = typename enable_if< __lazy_and< is_same<allocator_arg_t, _AllocArgT>, @@ -885,6 +888,25 @@ public: tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} + using _CanCopyAssign = __all<is_copy_assignable<_Tp>::value...>; + using _CanMoveAssign = __all<is_move_assignable<_Tp>::value...>; + + _LIBCPP_INLINE_VISIBILITY + tuple& operator=(typename conditional<_CanCopyAssign::value, tuple, __nat>::type const& __t) + _NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value)) + { + base_.operator=(__t.base_); + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + tuple& operator=(typename conditional<_CanMoveAssign::value, tuple, __nat>::type&& __t) + _NOEXCEPT_((__all<is_nothrow_move_assignable<_Tp>::value...>::value)) + { + base_.operator=(static_cast<base&&>(__t.base_)); + return *this; + } + template <class _Tuple, class = typename enable_if < |