(1) | ||
tuple& operator=( const tuple& other ); | (since C++11) (until C++20) | |
constexpr tuple& operator=( const tuple& other ); | (since C++20) | |
(2) | ||
tuple& operator=( tuple&& other ) noexcept(/* see below */); | (since C++11) (until C++20) | |
constexpr tuple& operator=( tuple&& other ) noexcept(/* see below */); | (since C++20) | |
(3) | ||
template< class... UTypes > tuple& operator=( const tuple<UTypes...>& other ); | (since C++11) (until C++20) | |
template< class... UTypes > constexpr tuple& operator=( const tuple<UTypes...>& other ); | (since C++20) | |
(4) | ||
template< class... UTypes > tuple& operator=( tuple<UTypes...>&& other ); | (since C++11) (until C++20) | |
template< class... UTypes > constexpr tuple& operator=( tuple<UTypes...>&& other ); | (since C++20) | |
(5) | ||
template< class U1, class U2 > tuple& operator=( const pair<U1,U2>& p ); | (since C++11) (until C++20) | |
template< class U1, class U2 > constexpr tuple& operator=( const pair<U1,U2>& p ); | (since C++20) | |
(6) | ||
template< class U1, class U2 > tuple& operator=( pair<U1,U2>&& p ); | (since C++11) (until C++20) | |
template< class U1, class U2 > constexpr tuple& operator=( pair<U1,U2>&& p ); | (since C++20) |
Replaces the contents of the tuple with the contents of another tuple or a pair.
1) Copy assignment operator. Assigns each element of other
to the corresponding element of *this
.
2) Move assignment operator. For all i
, assigns std::forward<Ti>(get<i>(other))
to get<i>(*this)
.
3) For all i
, assigns std::get<i>(other)
to std::get<i>(*this)
.
4) For all i
, assigns std::forward<Ui>(std::get<i>(other))
to std::get<i>(*this)
.
5) Assigns p.first
to the first element of *this
and p.second
to the second element of *this
.
6) Assigns std::forward<U1>(p.first)
to the first element of *this
and std::forward<U2>(p.second)
to the second element of *this
.
The behavior of these functions is undefined unless:
| (until C++17) |
These functions do not participate in overload resolution (or, for the copy assignment operator, is defined as deleted) if any required assignment operation is invalid or if there is a size mismatch. Specifically:
| (since C++17) |
other | - | tuple to replace the contents of this tuple |
p | - | pair to replace the contents of this 2-tuple |
*this
.
1) (none) 2).
noexcept
specification: noexcept( is_nothrow_move_assignable<T0>::value && is_nothrow_move_assignable<T1>::value && is_nothrow_move_assignable<T2>::value && ... )
3-6) (none).
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/utility/tuple/operator=