HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VE_ResultBase< T, E > Class Template Reference

#include <VE_Result.h>

Public Member Functions

 VE_ResultBase (T &&t)
 
 VE_ResultBase (E &&e)
 
bool ok () const
 Returns true if we have a valid result. Otherwise, we have an error. More...
 
T && unpack ()
 
E && error ()
 
T peek ()
 

Static Public Member Functions

static VE_ResultBase< T, E > copyFrom (T t)
 

Protected Attributes

std::variant< T, E > myItem
 

Detailed Description

template<typename T, typename E>
class VE_ResultBase< T, E >

Definition at line 24 of file VE_Result.h.

Constructor & Destructor Documentation

template<typename T, typename E>
VE_ResultBase< T, E >::VE_ResultBase ( T &&  t)
inline

Definition at line 27 of file VE_Result.h.

template<typename T, typename E>
VE_ResultBase< T, E >::VE_ResultBase ( E &&  e)
inline

Definition at line 28 of file VE_Result.h.

Member Function Documentation

template<typename T, typename E>
static VE_ResultBase<T, E> VE_ResultBase< T, E >::copyFrom ( T  t)
inlinestatic

Definition at line 30 of file VE_Result.h.

template<typename T, typename E>
E&& VE_ResultBase< T, E >::error ( )
inline

Moves the error out of result. Once this is called, the VE_ResultBase object is in an undefined state and MUST NOT be accessed again.

Definition at line 46 of file VE_Result.h.

template<typename T, typename E>
bool VE_ResultBase< T, E >::ok ( ) const
inline

Returns true if we have a valid result. Otherwise, we have an error.

Definition at line 33 of file VE_Result.h.

template<typename T, typename E>
T VE_ResultBase< T, E >::peek ( )
inline

Copies the value out for classes that suuport copying, allowing result to still be used. I am not sure if this is an actually a useful method to have, and am worried it might provide a false sense of safety around accessing result values multiply times.

Definition at line 58 of file VE_Result.h.

template<typename T, typename E>
T&& VE_ResultBase< T, E >::unpack ( )
inline

Moves the value out of result. Once this is called, the VE_ResultBase object is in an undefined state and MUST NOT be accessed again.

Definition at line 37 of file VE_Result.h.

Member Data Documentation

template<typename T, typename E>
std::variant<T, E> VE_ResultBase< T, E >::myItem
protected

Definition at line 66 of file VE_Result.h.


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