Hermes
Loading...
Searching...
No Matches
hermes::Result< T, E > Class Template Reference

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

#include <result.h>

Public Member Functions

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

Static Public Member Functions

static HERMES_DEVICE_CALLABLE Result< T, Eerror (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  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: