Template Class Result< void, E >¶
Defined in File Result.hpp
Class Documentation¶
-
template<typename
E
>
classActs
::
Result
<void, E>¶ Template specialization for the void case.
This specialization handles the case where there is no actual return value, but an error might be returned. Returning the error directly would make handling different from other functions using the
Result<T, E>
mechanism.Result<void, E>
does not have the dereference operator, and value methods. The staticsuccess
factory does not accept a value.- Note
To ease usage, this
Result<void, E>
is default constructible in the ok state, whereasResult<T, E>
is not.- Template Parameters
E
: The type of the error
Public Functions
-
Result
() = default¶ Default constructor which initializes the result in the ok state.
-
Result
(Result<void, E> &&other)¶ Move constructor.
- Parameters
other
: The other result object, rvalue ref
-
template<typename
E2
>Result
(E2 error) noexcept¶ Constructor from error.
This implicitly requires E2 to be convertible to E.
- Template Parameters
E2
: The type of the actual error
- Parameters
error
: The instance of the actual error
-
E &
error
() & noexcept¶ Returns a reference to the error stored in the result.
- Note
If
res.ok()
this method will abort (noexcept)- Return
Reference to the error
-
E
error
() && noexcept¶ Returns the error by-value.
- Note
If
res.ok()
this method will abort (noexcept)- Return
Reference to the error
-
bool
ok
() const noexcept¶ Checks whether this result is in the ok state, and no error.
- Return
bool Whether result contains an error or not.
-
Result<void, E> &
operator=
(const Result<void, E> &other) = default¶ The (self) assignment operator is deleted.