std::tuple::operator=

From Cppreference

Jump to: navigation, search
tuple& operator=( const tuple& other );
(1) (C++11 feature)
tuple& operator=( tuple&& other );
(2) (C++11 feature)
template< class... UTypes >
tuple& operator=( const tuple<UTypes...>& other );
(3) (C++11 feature)
template< class... UTypes >
tuple& operator=( tuple<UTypes...>&& other );
(4) (C++11 feature)
template< class U1, class U2 >
tuple& operator=( const pair<U1,U2>& p );
(5) (C++11 feature)
template< class U1, class U2 >
tuple& operator=( pair<U1,U2>&& p );
(6) (C++11 feature)

Replaces the contents of the tuple with the contents of another tuple or a pair.

1) Copy assignment operator. Replaces each element with a copy of the corresponding element of other.

2) Move assignment operator. Replaces each element with the corresponding element of other using move semantics.

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.

Contents

[edit] Parameters

other - tuple to replace the contents of this tuple
p - pair to replace the contents of this 2-tuple

[edit] Return value

*this

[edit] Exceptions

1) (none)

2) noexcept specification:  (C++11 feature)

noexcept(noexcept(

    is_nothrow_move_assignable<T0>::value &&
    is_nothrow_move_assignable<T1>::value &&
    is_nothrow_move_assignable<T2>::value &&
    ...

)

3-5) (none)

6)
noexcept specification:  
noexcept

  (C++11 feature)

[edit] Example

[edit] See also