19 General utilities library [utilities]

19.5 Tuples [tuple]

19.5.3 Class template tuple [tuple.tuple]

19.5.3.2 Assignment [tuple.assign]

For each tuple assignment operator, an exception is thrown only if the assignment of one of the types in Types throws an exception.
In the function descriptions that follow, let i be in the range [0, sizeof...(Types)) in order, T be the type in Types, and U be the type in a template parameter pack named UTypes, where indexing is zero-based.
tuple& operator=(const tuple& u);
Effects: Assigns each element of u to the corresponding element of *this.
Remarks: This operator shall be defined as deleted unless is_­copy_­assignable_­v<T> is true for all i.
Returns: *this.
tuple& operator=(tuple&& u) noexcept(see below);
Effects: For all i, assigns std::forward<T>(get<i>(u)) to get<i>(*this).
Remarks: This operator shall not participate in overload resolution unless is_­move_­assignable_­v<T> is true for all i.
Remarks: The expression inside noexcept is equivalent to the logical and of the following expressions:
is_nothrow_move_assignable_v<>
where is the type in Types.
Returns: *this.
template<class... UTypes> tuple& operator=(const tuple<UTypes...>& u);
Effects: Assigns each element of u to the corresponding element of *this.
Remarks: This operator shall not participate in overload resolution unless sizeof...(Types) == sizeof...(UTypes) and is_­assignable_­v<T&, const U&> is true for all i.
Returns: *this.
template<class... UTypes> tuple& operator=(tuple<UTypes...>&& u);
Effects: For all i, assigns std::forward<U>(get<i>(u)) to get<i>(*this).
Remarks: This operator shall not participate in overload resolution unless is_­assignable_­v<T&, U&&> == true for all i and sizeof...(Types) == sizeof...(UTypes).
Returns: *this.
template<class U1, class U2> tuple& operator=(const pair<U1, U2>& u);
Effects: Assigns u.first to the first element of *this and u.second to the second element of *this.
Remarks: This operator shall not participate in overload resolution unless sizeof...(Types) == 2 and is_­assignable_­v<T&, const U1&> is true for the first type T in Types and is_­assignable_­v<T&, const U2&> is true for the second type T in Types.
Returns: *this.
template<class U1, class U2> tuple& operator=(pair<U1, U2>&& u);
Effects: Assigns std::forward<U1>(u.first) to the first element of *this and
std::forward<U2>(u.second) to the second element of *this.
Remarks: This operator shall not participate in overload resolution unless sizeof...(Types) == 2 and is_­assignable_­v<T&, U1&&> is true for the first type T in Types and is_­assignable_­v<T&, U2&&> is true for the second type T in Types.
Returns: *this.