[expected.void.assign] (original) (raw)

22 General utilities library [utilities]

22.8 Expected objects [expected]

22.8.7 Partial specialization of expected for void types [expected.void]

22.8.7.4 Assignment [expected.void.assign]

constexpr expected& operator=(const expected& rhs);

Effects:

Remarks: This operator is defined as deleted unlessis_copy_assignable_v<E> is true andis_copy_constructible_v<E> is true.

constexpr expected& operator=(expected&& rhs) noexcept(_see below_);

Constraints: is_move_constructible_v<E> is true andis_move_assignable_v<E> is true.

Effects:

Remarks: The exception specification is equivalent tois_nothrow_move_constructible_v<E> && is_nothrow_move_assignable_v<E>.

template<class G> constexpr expected& operator=(const unexpected<G>& e);template<class G> constexpr expected& operator=(unexpected<G>&& e);

Let GF be const G& for the first overload andG for the second overload.

Constraints: is_constructible_v<E, GF> is true andis_assignable_v<E&, GF> is true.

Effects:

constexpr void emplace() noexcept;

Effects: If has_value() is false, destroys unex and sets has_val to true.