optris::sdk::Expected< void, E >
Expected<void, E>`: it succeeded, or it did not and here is why.
Public types
value_type
void value_type
Nothing is carried on success.
error_type
E error_type
The error type on failure.
Public functions
Expected
constexpr Expected()
Success. return {}; is the idiom throughout the recording library.
Expected
constexpr Expected(U &&unex)
The error arm. See the general case above for why it is duck-typed rather than taking Unexpected alone.
Parameters
| Name | Description |
|---|---|
unex |
An Unexpected, or anything shaped like one. |
has_value
constexpr bool has_value() const noexcept
Returns: True when the operation succeeded.
operator bool
constexpr operator bool() const noexcept
Returns: has_value(), so a call site reads if (!result).
value
void value() const
Present so Result<void> reads like its siblings at a call site that only checks. Throws if there is no value, like the general case.
error
constexpr const E & error() const &
Returns: The error. Undefined when has_value() is true.
error
constexpr E & error() &
Returns: The error. Undefined when has_value() is true.
error
constexpr E && error() &&
Returns: The error, moved out.