Otherwise, if this->has_value() is true, equivalent to:
construct_at(addressof(unex), std::move(rhs.unex));
has_val = false;
Otherwise, if
rhs.has_value() is
true,
destroys
unex and sets
has_val to
true.Otherwise, equivalent to
unex = std::move(rhs.error().Remarks: The exception specification is equivalent to
is_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 and
G for the second overload
.Constraints:
is_constructible_v<E, GF> is
true and
is_assignable_v<E&, GF> is
true. Effects:
- If has_value() is true, equivalent to:
construct_at(addressof(unex), std::forward<GF>(e.error();
has_val = false;
- Otherwise, equivalent to:
unex = std::forward<GF>(e.error();
constexpr void emplace() noexcept;
Effects: If
has_value() is
false,
destroys
unex and sets
has_val to
true.