Hermes
hermes::Result< T, E > Class Template Reference

Holds a valid object or an error. More...

Public Member Functions

HERMES_DEVICE_CALLABLE Result (const UnexpectedResultType< E > &err={})
 
HERMES_DEVICE_CALLABLE Result (const T &v)
 Value constructor. More...
 
HERMES_DEVICE_CALLABLE Result (T &&v)
 Move value constructor. More...
 
HERMES_DEVICE_CALLABLE Result (const Result &other)
 Copy constructor. More...
 
HERMES_DEVICE_CALLABLE Result (Result &&other) noexcept
 Move constructor. More...
 
HERMES_DEVICE_CALLABLE operator bool () const noexcept
 Casts to bool (indicates whether this contains value) More...
 
HERMES_DEVICE_CALLABLE Resultoperator= (const Result &other)
 Copy assignment. More...
 
HERMES_DEVICE_CALLABLE Resultoperator= (Result &&other) noexcept
 Move assignment. More...
 
HERMES_DEVICE_CALLABLE Resultoperator= (const T &v)
 Value assignment. More...
 
HERMES_DEVICE_CALLABLE Resultoperator= (T &&v)
 Move value assignment. More...
 
HERMES_DEVICE_CALLABLE T * operator-> ()
 Gets value pointer. More...
 
HERMES_DEVICE_CALLABLE const T * operator-> () const
 Gets const value pointer. More...
 
HERMES_DEVICE_CALLABLE T & operator* ()
 Gets value reference. More...
 
HERMES_DEVICE_CALLABLE const T & operator* () const
 Gets value const reference. More...
 
HERMES_DEVICE_CALLABLE bool good () const
 
HERMES_DEVICE_CALLABLEstatus () const
 
HERMES_DEVICE_CALLABLE void reset ()
 Destroys stored value (if present)
 
HERMES_DEVICE_CALLABLEvalueOr (const T &v) const
 Gets value copy (if present) More...
 
HERMES_DEVICE_CALLABLE T & value ()
 Gets value's reference. More...
 
HERMES_DEVICE_CALLABLE const T & value () const
 Gets value's const reference. More...
 

Static Public Member Functions

static HERMES_DEVICE_CALLABLE Result< T, E > error (E e)
 

Detailed Description

template<class T, class E = HeResult>
class hermes::Result< T, E >

Holds a valid object or an error.

Constructor & Destructor Documentation

◆ Result() [1/5]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE hermes::Result< T, E >::Result ( const UnexpectedResultType< E > &  err = {})
inlineexplicit
Parameters
err

◆ Result() [2/5]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE hermes::Result< T, E >::Result ( const T &  v)
inlineexplicit

Value constructor.

Parameters
v

◆ Result() [3/5]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE hermes::Result< T, E >::Result ( T &&  v)
inlineexplicit

Move value constructor.

Parameters
v

◆ Result() [4/5]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE hermes::Result< T, E >::Result ( const Result< T, E > &  other)
inline

Copy constructor.

Parameters
other

◆ Result() [5/5]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE hermes::Result< T, E >::Result ( Result< T, E > &&  other)
inlinenoexcept

Move constructor.

Parameters
other

Member Function Documentation

◆ error()

template<class T , class E = HeResult>
static HERMES_DEVICE_CALLABLE Result<T, E> hermes::Result< T, E >::error ( e)
inlinestatic
Parameters
e
Returns

◆ operator bool()

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE hermes::Result< T, E >::operator bool ( ) const
inlineexplicitnoexcept

Casts to bool (indicates whether this contains value)

Returns

◆ operator*() [1/2]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE T& hermes::Result< T, E >::operator* ( )
inline

Gets value reference.

Returns

◆ operator*() [2/2]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE const T& hermes::Result< T, E >::operator* ( ) const
inline

Gets value const reference.

Returns

◆ operator->() [1/2]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE T* hermes::Result< T, E >::operator-> ( )
inline

Gets value pointer.

Returns

◆ operator->() [2/2]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE const T* hermes::Result< T, E >::operator-> ( ) const
inline

Gets const value pointer.

Returns

◆ operator=() [1/4]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE Result& hermes::Result< T, E >::operator= ( const Result< T, E > &  other)
inline

Copy assignment.

Parameters
other
Returns

◆ operator=() [2/4]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE Result& hermes::Result< T, E >::operator= ( const T &  v)
inline

Value assignment.

Parameters
v
Returns

◆ operator=() [3/4]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE Result& hermes::Result< T, E >::operator= ( Result< T, E > &&  other)
inlinenoexcept

Move assignment.

Parameters
other
Returns

◆ operator=() [4/4]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE Result& hermes::Result< T, E >::operator= ( T &&  v)
inline

Move value assignment.

Parameters
v
Returns

◆ value() [1/2]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE T& hermes::Result< T, E >::value ( )
inline

Gets value's reference.

Returns

◆ value() [2/2]

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE const T& hermes::Result< T, E >::value ( ) const
inline

Gets value's const reference.

Returns

◆ valueOr()

template<class T , class E = HeResult>
HERMES_DEVICE_CALLABLE T hermes::Result< T, E >::valueOr ( const T &  v) const
inline

Gets value copy (if present)

Parameters
vvalue returned in case of empty
Returns

The documentation for this class was generated from the following file: