Files
2025-10-25 03:02:53 +03:00

3.8 KiB
Raw Permalink Blame History

[expected.void.obs]

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;

1

#

Returns: has_val.

🔗

constexpr void operator*() const noexcept;

2

#

Hardened preconditions: has_value() is true.

🔗

constexpr void value() const &;

3

#

Mandates: is_copy_constructible_v is true.

4

#

Throws: bad_expected_access(error()) if has_value() is false.

🔗

constexpr void value() &&;

5

#

Mandates: is_copy_constructible_v is true andis_move_constructible_v is true.

6

#

Throws: bad_expected_access(std::move(error())) if has_value() is false.

🔗

constexpr const E& error() const & noexcept; constexpr E& error() & noexcept;

7

#

Hardened preconditions: has_value() is false.

8

#

Returns: unex.

🔗

constexpr E&& error() && noexcept; constexpr const E&& error() const && noexcept;

9

#

Hardened preconditions: has_value() is false.

10

#

Returns: std::move(unex).

🔗

template<class G = E> constexpr E error_or(G&& e) const &;

11

#

Mandates: is_copy_constructible_v is true andis_convertible_v<G, E> is true.

12

#

Returns: std::forward(e) if has_value() is true,error() otherwise.

🔗

template<class G = E> constexpr E error_or(G&& e) &&;

13

#

Mandates: is_move_constructible_v is true andis_convertible_v<G, E> is true.

14

#

Returns: std::forward(e) if has_value() is true,std::move(error()) otherwise.