22 General utilities library [utilities] (original) (raw)

22.4 Tuples [tuple]

22.4.4 Class template tuple [tuple.tuple]

22.4.4.3 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, be the type in Types, and be the type in a template parameter pack named UTypes, where indexing is zero-based.

constexpr tuple& operator=(const tuple& u);

Effects: Assigns each element of u to the corresponding element of *this.

Remarks: This operator is defined as deleted unlessis_copy_assignable_v<> is true for all i.

constexpr const tuple& operator=(const tuple& u) const;

Constraints: (is_copy_assignable_v<const Types> && ...) is true.

Effects: Assigns each element of u to the corresponding element of *this.

constexpr tuple& operator=(tuple&& u) noexcept(_see below_);

Constraints: is_move_assignable_v<> is true for all i.

Effects: For all i, assigns std​::​forward<>(get<i>(u)) toget<i>(*this).

Remarks: The exception specification is equivalent to the logical and of the following expressions:is_nothrow_move_assignable_v<> where is the type in Types.

constexpr const tuple& operator=(tuple&& u) const;

Constraints: (is_assignable_v<const Types&, Types> && ...) is true.

Effects: For all i, assigns std​::​forward<T>(get<i>(u)) to get<i>(*this).

template<class... UTypes> constexpr tuple& operator=(const tuple<UTypes...>& u);

Constraints:

Effects: Assigns each element of u to the corresponding element of *this.

template<class... UTypes> constexpr const tuple& operator=(const tuple<UTypes...>& u) const;

Constraints:

Effects: Assigns each element of u to the corresponding element of *this.

template<class... UTypes> constexpr tuple& operator=(tuple<UTypes...>&& u);

Constraints:

Effects: For all i, assigns std​::​forward<>(get<i>(u)) toget<i>(*this).

template<class... UTypes> constexpr const tuple& operator=(tuple<UTypes...>&& u) const;

Constraints:

Effects: For all i, assigns std​::​forward<U>(get<i>(u)) to get<i>(*this).

template<class U1, class U2> constexpr tuple& operator=(const pair<U1, U2>& u);

Constraints:

Effects: Assigns u.first to the first element of *thisand u.second to the second element of *this.

template<class U1, class U2> constexpr const tuple& operator=(const pair<U1, U2>& u) const;

Constraints:

Effects: Assigns u.first to the first element andu.second to the second element.

template<class U1, class U2> constexpr tuple& operator=(pair<U1, U2>&& u);

Constraints:

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.

template<class U1, class U2> constexpr const tuple& operator=(pair<U1, U2>&& u) const;

Constraints:

Effects: Assigns std​::​forward<U1>(u.first) to the first element and

std​::​forward<U2>(u.second) to the second element.

template<[_tuple-like_](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") UTuple> constexpr tuple& operator=(UTuple&& u);

Constraints:

Effects: For all i, assigns get<i>(std​::​forward<UTuple>(u))to get<i>(*this).

template<[_tuple-like_](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]") UTuple> constexpr const tuple& operator=(UTuple&& u) const;

Constraints:

Effects: For all i, assignsget<i>(std​::​forward<UTuple>(u)) to get<i>(*this).