Furrent
Public Member Functions | Static Public Member Functions | List of all members
fur::util::Result< R, E > Class Template Reference

Used to handle errors without using exceptions. More...

#include <result.hpp>

Public Member Functions

 Result (const Result &)=delete
 
Resultoperator= (const Result &)=delete
 
 Result (Result &&) noexcept
 
Resultoperator= (Result &&) noexcept
 
bool valid () const
 
R & operator* ()
 
R * operator-> ()
 
const E & error () const
 

Static Public Member Functions

static Result OK (R &&result)
 Creates an ok result. More...
 
static Result ERROR (E &&error)
 Creates an error result. More...
 

Detailed Description

template<typename R, typename E>
class fur::util::Result< R, E >

Used to handle errors without using exceptions.

Template Parameters
Rtype of the result
Etype of the error

Constructor & Destructor Documentation

◆ Result() [1/2]

template<typename R , typename E >
fur::util::Result< R, E >::Result ( const Result< R, E > &  )
delete

◆ Result() [2/2]

template<typename R , typename E >
fur::util::Result< R, E >::Result ( Result< R, E > &&  o)
noexcept

Member Function Documentation

◆ error()

template<typename R , typename E >
const E & fur::util::Result< R, E >::error
Returns
error that occurred

◆ ERROR()

template<typename R , typename E >
auto fur::util::Result< R, E >::ERROR ( E &&  error)
static

Creates an error result.

◆ OK()

template<typename R , typename E >
auto fur::util::Result< R, E >::OK ( R &&  result)
static

Creates an ok result.

◆ operator*()

template<typename R , typename E >
R & fur::util::Result< R, E >::operator*
Returns
Result if it is present, undefined behaviour otherwise

◆ operator->()

template<typename R , typename E >
R * fur::util::Result< R, E >::operator->
Returns
Result if it is present, undefined behaviour otherwise

◆ operator=() [1/2]

template<typename R , typename E >
Result& fur::util::Result< R, E >::operator= ( const Result< R, E > &  )
delete

◆ operator=() [2/2]

template<typename R , typename E >
Result< R, E > & fur::util::Result< R, E >::operator= ( Result< R, E > &&  o)
noexcept

◆ valid()

template<typename R , typename E >
bool fur::util::Result< R, E >::valid
Returns
True if there is no error.

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