[expected.void.obs] (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.6 Observers [expected.void.obs]
constexpr explicit operator bool() const noexcept;constexpr bool has_value() const noexcept;
constexpr void operator*() const noexcept;
Hardened preconditions: has_value() is true.
constexpr void value() const &;
Mandates: is_copy_constructible_v<E> is true.
Throws: bad_expected_access(error()) if has_value() is false.
constexpr void value() &&;
Mandates: is_copy_constructible_v<E> is true andis_move_constructible_v<E> is true.
Throws: bad_expected_access(std::move(error()))if has_value() is false.
constexpr const E& error() const & noexcept;constexpr E& error() & noexcept;
Hardened preconditions: has_value() is false.
constexpr E&& error() && noexcept;constexpr const E&& error() const && noexcept;
Hardened preconditions: has_value() is false.
Returns: std::move(unex).
template<class G = E> constexpr E error_or(G&& e) const &;
Mandates: is_copy_constructible_v<E> is true andis_convertible_v<G, E> is true.
Returns: std::forward<G>(e) if has_value() is true,error() otherwise.
template<class G = E> constexpr E error_or(G&& e) &&;
Mandates: is_move_constructible_v<E> is true andis_convertible_v<G, E> is true.
Returns: std::forward<G>(e) if has_value() is true,std::move(error()) otherwise.