#include <resultbase.h>
ResultMemT can be used as return type of functions which normally return a T, but might fail only due to an out-of-memory situation and indicate this by the null value of T. The typical use-case is for pointers or strong/unique references. You can't use ResultMemT when the null value of T shall be a legal return value of the function, in that case you have to use Result.
Public Member Functions | |
ResultMemT () | |
MAXON_IMPLICIT | ResultMemT (ERROR_FAILED) |
MAXON_IMPLICIT | ResultMemT (const T &value) |
MAXON_IMPLICIT | ResultMemT (T &&value) |
MAXON_IMPLICIT | ResultMemT (ERROR_OK) |
MAXON_IMPLICIT | ResultMemT (ResultOk< void >) |
ResultMemT (const ResultMemT &)=default | |
ResultMemT & | operator= (const ResultMemT &)=default |
ResultMemT (ResultMemT &&)=default | |
ResultMemT & | operator= (ResultMemT &&)=default |
template<typename T2 , typename = typename std::enable_if<STD_IS_REPLACEMENT(constructible, T, T2*) && STD_IS_REPLACEMENT(pointer, T)>::type> | |
MAXON_IMPLICIT | ResultMemT (const ResultMemT< T2 * > &result) |
template<typename T2 , typename = typename std::enable_if<STD_IS_REPLACEMENT(constructible, T, T2*) && STD_IS_REPLACEMENT(pointer, T)>::type> | |
MAXON_IMPLICIT | ResultMemT (ResultMemT< T2 * > &&result) |
template<typename T2 , typename = typename std::enable_if<STD_IS_REPLACEMENT(constructible, T, T2) && STD_IS_REPLACEMENT(pointer, T) == STD_IS_REPLACEMENT(pointer, T2)>::type> | |
MAXON_IMPLICIT | ResultMemT (const ResultMemT< T2 > &result) |
template<typename T2 , typename = typename std::enable_if<STD_IS_REPLACEMENT(constructible, T, T2) && STD_IS_REPLACEMENT(pointer, T) == STD_IS_REPLACEMENT(pointer, T2)>::type> | |
MAXON_IMPLICIT | ResultMemT (ResultMemT< T2 > &&result) |
template<typename T2 > | |
MAXON_IMPLICIT | ResultMemT (const ResultRef< T2 > &result) |
Bool | operator== (ERROR_OK ok) const |
Bool | operator== (ERROR_FAILED failed) const |
const T & | GetValue () const & |
const T & | UncheckedGetValue () const & |
MAXON_MEMBER_ACCESSORS (T, GetValue) | |
MAXON_MEMBER_ACCESSORS (T, UncheckedGetValue) | |
T | GetPointer () const |
Private Member Functions | |
Bool | IsOK (const std::false_type *) const |
Bool | IsOK (const void *) const |
Private Attributes | |
T | _value |
ResultMemT | ( | ) |
MAXON_IMPLICIT ResultMemT | ( | const T & | value | ) |
MAXON_IMPLICIT ResultMemT | ( | T && | value | ) |
MAXON_IMPLICIT ResultMemT | ( | ResultOk< void > | ) |
|
default |
|
default |
MAXON_IMPLICIT ResultMemT | ( | const ResultMemT< T2 * > & | result | ) |
MAXON_IMPLICIT ResultMemT | ( | ResultMemT< T2 * > && | result | ) |
MAXON_IMPLICIT ResultMemT | ( | const ResultMemT< T2 > & | result | ) |
MAXON_IMPLICIT ResultMemT | ( | ResultMemT< T2 > && | result | ) |
MAXON_IMPLICIT ResultMemT | ( | const ResultRef< T2 > & | result | ) |
|
default |
|
default |
Bool operator== | ( | ERROR_FAILED | failed | ) | const |
==(ERROR_FAILED)
==(ERROR_FAILED)
const T& GetValue | ( | ) | const & |
Returns the result value. This function must not be called when there is no value because an out-of-memory error occurred.
const T& UncheckedGetValue | ( | ) | const & |
Returns the result value, or a null value in case of an out-of-memory error.
MAXON_MEMBER_ACCESSORS | ( | T | , |
GetValue | |||
) |
MAXON_MEMBER_ACCESSORS | ( | T | , |
UncheckedGetValue | |||
) |
T GetPointer | ( | ) | const |
Returns the result value. This function is only supported if T is a pointer type.
|
private |
|
private |
|
private |