Template Class Expected< void >#

Class Documentation#

template<>
class Expected<void>#

Specialization of Expected for a successful operation without a value.

Expected<void> stores FFI None when successful and an Error when unsuccessful. A successful value is constructed with the default constructor, and value validates success without returning a value.

Public Functions

Expected() = default#

Construct a successful Expected<void>.

inline Expected(Error error)#

Implicit constructor from an error.

Parameters:

error – The error value.

template<typename E, typename = std::enable_if_t<std::is_base_of_v<Error, std::remove_cv_t<E>>>>
inline Expected(Unexpected<E> unexpected)#

Implicit constructor from an Unexpected wrapper.

inline int32_t type_index() const noexcept#

Return the raw stored type index.

inline bool is_ok() const noexcept#

Returns true if this Expected represents successful completion.

inline bool is_err() const noexcept#

Returns true if this Expected contains an error.

inline bool has_value() const noexcept#

Alias for is_ok().

inline void value() const &#

Validate successful completion, or throw the contained error.

inline void value() &&#

Validate successful completion, or throw the contained error by move.

inline Error error() const &#

Returns the contained error, or throws RuntimeError if is_ok().

inline Error error() &&#

Returns the contained error (moved out), or throws RuntimeError if is_ok().