Result<void, E> — an operation that either succeeded or failed with E. More...
#include <result.hpp>
Public Types | |
| using | value_type = void |
| using | error_type = E |
Public Member Functions | |
| Result () noexcept | |
| Success. | |
| Result (Err< E > err) | |
| Result (const Result &other) | |
| Result (Result &&other) noexcept(std::is_nothrow_move_constructible_v< E >) | |
| Result & | operator= (const Result &other) |
| Result & | operator= (Result &&other) noexcept(std::is_nothrow_move_constructible_v< E >) |
| ~Result () | |
| bool | has_value () const noexcept |
| operator bool () const noexcept | |
| bool | is_err () const noexcept |
| void | value () const noexcept |
| Present so generic code can call value() uniformly. | |
| E & | error () & |
| const E & | error () const & |
| E && | error () && |
| void & | operator* () & |
| void * | operator-> () |
| void | value_or (U &&fallback) const & |
| Return the held value, or fallback when this is an error. | |
Result<void, E> — an operation that either succeeded or failed with E.
The primary template stores T and E in a union, and a union cannot hold void, so "succeeded, with nothing to hand back" needs its own specialization rather than a placeholder type. std::expected<void, E> exists for the same reason.
A default-constructed Result<void, E> is the SUCCESS state, which is what makes return {}; read as "fine" at a call site. Failure is still return Err(...);, so both forms match the primary template.
| using pulp::runtime::Result< void, E >::error_type = E |
| using pulp::runtime::Result< void, E >::value_type = void |
|
inlinenoexcept |
Success.
|
inline |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineexplicitnoexcept |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
Present so generic code can call value() uniformly.
There is nothing to return; calling it on an error result is UB, as in the primary template.
|
inline |
Return the held value, or fallback when this is an error.
| E pulp::runtime::Result< void, E >::error_ |