std::expected<T,E>::value
From cppreference.com
| T is not cv void |
||
| constexpr T& value() &; |
(1) | (since C++23) |
| constexpr const T& value() const&; |
(2) | (since C++23) |
| constexpr T&& value() &&; |
(3) | (since C++23) |
| constexpr const T&& value() const&&; |
(4) | (since C++23) |
| T is cv void |
||
| constexpr void value() const&; |
(5) | (since C++23) |
| constexpr void value() &&; |
(6) | (since C++23) |
If *this contains an expected value, returns a reference to the contained value.
Otherwise, throws a std::bad_expected_access exception that contains a copy of the unexpected value contained in *this.
Contents |
[edit] Parameters
(none)
[edit] Return value
1-4) A reference to the expected value contained in
*this.5-6) (none)
[edit] Exceptions
1-2,5) Throws std::bad_expected_access(error()) if *this contain an unexpected value.
3-4,6) Throws std::bad_expected_access(std::move(error())) if *this contain an unexpected value.
[edit] Example
| This section is incomplete Reason: no example |
[edit] See also
| (C++23) |
returns the expected value if present, another value otherwise (public member function) |
| (C++23) |
accesses the expected value (public member function) |
| (C++23) |
returns the unexpected value (public member function) |
| (C++23) |
exception indicating checked access to an expected that contains an unexpected value (class template) |