![]() |
Contur 2
Educational OS kernel simulator
|
Specialization of Result for void — operations that produce no value on success. More...
#include <error.h>
Public Member Functions | |
| bool | isOk () const noexcept |
| Returns true if this Result represents success. | |
| bool | isError () const noexcept |
| Returns true if this Result represents failure. | |
| ErrorCode | errorCode () const noexcept |
| Returns the error code (Ok if successful). | |
| const void & | value () const & |
| Returns a const reference to the success value. | |
| void | valueOr (void defaultValue) const & |
| Returns the value if ok, or the provided default value if error. | |
Static Public Member Functions | |
| static Result | ok () |
| Constructs a successful void Result. | |
| static Result | error (ErrorCode code) |
| Constructs a failed void Result with the given error code. | |
Private Member Functions | |
| Result (ErrorCode code) | |
Private Attributes | |
| ErrorCode | code_ |
| std::variant< void, ErrorCode > | storage_ |
Specialization of Result for void — operations that produce no value on success.
|
inlineexplicitprivate |
|
inlinestaticnodiscard |
Constructs a failed void Result with the given error code.
Definition at line 195 of file error.h.
References contur::Ok, and Result().
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
Returns true if this Result represents failure.
Definition at line 208 of file error.h.
References code_, and contur::Ok.
|
inlinenodiscardnoexcept |
Returns true if this Result represents success.
Definition at line 202 of file error.h.
References code_, and contur::Ok.
|
inlinestaticnodiscard |
Constructs a successful void Result.
Definition at line 189 of file error.h.
References contur::Ok, and Result().
|
inlinenodiscard |
|
inlinenodiscard |
|
private |
|
private |