The Pedigree Project  0.1
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Result< T, E > Class Template Reference

#include <Result.h>

+ Collaboration diagram for Result< T, E >:

Public Member Functions

const T & value () const
 
const E & error () const
 
bool hasError () const
 
bool hasValue () const
 

Static Public Member Functions

static Result< T, E > withValue (const T &v)
 
static Result< T, E > withError (const E &e)
 

Private Types

typedef pedigree_std::remove_reference< T >::type BaseValueType
 

Private Member Functions

 Result (const T &v)
 
 Result (const E &e, bool)
 

Private Attributes

m_Value
 
m_Error
 
bool m_HasError
 

Static Private Attributes

static const BaseValueType m_DefaultValue = Result<T, E>::BaseValueType()
 

Detailed Description

template<class T, class E>
class Result< T, E >

Result encapsulates a typed result and an optional error in one object.

Either is valid, but both cannot be valid at the same time.

Result is useful for returning status in case of cases such as timeouts or other failures where overloading a return value (e.g. a pointer) is not a desirable action.

Definition at line 36 of file Result.h.


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