#include <resultbase.h>
Use ResultOk<T> instead of Result<T> as return type of a function which cannot fail, but whose return value will be checked for errors nevertheless. For example, this can happen if the function is overloaded and the other overload may return an error. Now if within a template function the overload in a call is chosen depending on the template arguments, the result has to be checked for an error, so also the function which cannot fail has to return a value which is understood by the error handling.
Public Member Functions | |
ResultOk () | |
MAXON_IMPLICIT | ResultOk (const T &value) |
MAXON_IMPLICIT | ResultOk (T &&value) |
const T & | GetValue () const & |
const T & | UncheckedGetValue () const & |
MAXON_MEMBER_ACCESSORS (T, GetValue) | |
MAXON_MEMBER_ACCESSORS (T, UncheckedGetValue) | |
Bool | operator== (ERROR_OK ok) const |
Bool | operator== (ERROR_FAILED failed) const |
Protected Attributes | |
T | _value |
Private Member Functions | |
const ThreadReferencedError & | GetErrorStorage () const |
MAXON_IMPLICIT ResultOk | ( | const T & | value | ) |
MAXON_IMPLICIT ResultOk | ( | T && | value | ) |
const T& GetValue | ( | void | ) | const & |
Returns the result value.
const T& UncheckedGetValue | ( | ) | const & |
Returns the result value.
MAXON_MEMBER_ACCESSORS | ( | T | , |
GetValue | |||
) |
MAXON_MEMBER_ACCESSORS | ( | T | , |
UncheckedGetValue | |||
) |
Returns always true because a ResultOk never contains an error.
[in] | ok | Use the global constant OK. |
Bool operator== | ( | ERROR_FAILED | failed | ) | const |
Returns always false because a ResultOk never contains an error.
[in] | failed | Use the global constant FAILED. |
|
private |
|
protected |