RPNX::DataStructures
Header-only C++ data structures and supporting utilities.
Loading...
Searching...
No Matches
rpnx::result< void > Class Reference

Specialization of the result class for void type. More...

#include <result.hpp>

Public Member Functions

 result ()
 Constructs an empty result object.
 
 result (std::exception_ptr er)
 Constructs a result object with an exception.
 
void test () const
 Tests if the result contains an exception and rethrows it if present.
 
void get () const
 Gets the stored value (void).
 
void value () const
 Alias for get().
 
void set_value ()
 Sets the value of the result (void).
 
void set_error (std::exception_ptr er)
 Sets the exception of the result.
 
void set_exception (std::exception_ptr er)
 Alias for set_error().
 
bool has_value () const
 Checks if the result has a value (void).
 
bool has_error () const
 Checks if the result has an exception.
 
bool has_exception () const
 Alias for has_error().
 
std::exception_ptr get_error () const
 Gets the stored exception.
 
bool has_result () const
 Checks if the result has a value (void) or an exception.
 
 operator bool () const
 Implicit conversion to bool.
 
 result (void t)
 Constructs a result object with a value.
 
 result ()
 Constructs an empty result object.
 
 result (std::exception_ptr er)
 Constructs a result object with an exception.
 
void test () const
 Tests if the result contains an exception and rethrows it if present.
 
void & get () &
 Returns the stored value from an lvalue result.
 
void const & get () const &
 Returns the stored value from an lvalue result.
 
void && get () &&
 Returns the stored value from an rvalue result.
 
void const && get () const &&
 Returns the stored value from an rvalue result.
 
void & value () &
 Alias for get().
 
void const & value () const &
 Alias for get().
 
void && value () &&
 Alias for rvalue-qualified get().
 
void const && value () const &&
 Alias for const rvalue-qualified get().
 
void set_value (void t)
 Sets the value of the result.
 
void set_error (std::exception_ptr er)
 Sets the exception of the result.
 
void set_exception (std::exception_ptr er)
 Alias for set_error().
 
bool has_result () const
 Checks if the result has a value or an exception.
 
bool has_value () const
 Checks if the result has a value.
 
bool has_error () const
 Checks if the result has an exception.
 
bool has_exception () const
 Alias for has_error().
 
std::exception_ptr get_error () const
 Gets the stored exception.
 
 operator bool () const
 Implicit conversion to bool.
 

Detailed Description

Specialization of the result class for void type.

Constructor & Destructor Documentation

◆ result() [1/3]

rpnx::result< void >::result ( std::exception_ptr er)
inline

Constructs a result object with an exception.

Parameters
erThe exception to store in the result.

◆ result() [2/3]

rpnx::result< void >::result ( void t)
inline

Constructs a result object with a value.

Parameters
tThe value to store in the result.

◆ result() [3/3]

rpnx::result< void >::result ( std::exception_ptr er)
inline

Constructs a result object with an exception.

Parameters
erThe exception to store in the result.

Member Function Documentation

◆ get() [1/5]

void & rpnx::result< void >::get ( ) &
inline

Returns the stored value from an lvalue result.

Returns
A mutable reference to the stored value.
Exceptions
Thestored exception when the result contains an error.
Precondition
The result contains a value or an error.

◆ get() [2/5]

void && rpnx::result< void >::get ( ) &&
inline

Returns the stored value from an rvalue result.

Returns
An rvalue reference to the stored value.
Exceptions
Thestored exception when the result contains an error.
Precondition
The result contains a value or an error.

◆ get() [3/5]

void rpnx::result< void >::get ( ) const
inline

Gets the stored value (void).

Exceptions
Thestored exception if present.
std::logic_errorif no value is stored.

◆ get() [4/5]

void const & rpnx::result< void >::get ( ) const &
inline

Returns the stored value from an lvalue result.

Returns
A mutable reference to the stored value.
Exceptions
Thestored exception when the result contains an error.
Precondition
The result contains a value or an error.

◆ get() [5/5]

void const && rpnx::result< void >::get ( ) const &&
inline

Returns the stored value from an rvalue result.

Returns
An rvalue reference to the stored value.
Exceptions
Thestored exception when the result contains an error.
Precondition
The result contains a value or an error.

◆ get_error() [1/2]

std::exception_ptr rpnx::result< void >::get_error ( ) const
inline

Gets the stored exception.

Returns
The stored exception.

◆ get_error() [2/2]

std::exception_ptr rpnx::result< void >::get_error ( ) const
inline

Gets the stored exception.

Returns
The stored exception.

◆ has_error() [1/2]

bool rpnx::result< void >::has_error ( ) const
inline

Checks if the result has an exception.

Returns
True if the result has an exception, false otherwise.

◆ has_error() [2/2]

bool rpnx::result< void >::has_error ( ) const
inline

Checks if the result has an exception.

Returns
True if the result has an exception, false otherwise.

◆ has_exception() [1/2]

bool rpnx::result< void >::has_exception ( ) const
inline

Alias for has_error().

Returns
true if an exception is stored.

◆ has_exception() [2/2]

bool rpnx::result< void >::has_exception ( ) const
inline

Alias for has_error().

Returns
true if an exception is stored.

◆ has_result() [1/2]

bool rpnx::result< void >::has_result ( ) const
inline

Checks if the result has a value or an exception.

Returns
True if the result has a value or an exception, false otherwise.

◆ has_result() [2/2]

bool rpnx::result< void >::has_result ( ) const
inline

Checks if the result has a value (void) or an exception.

Returns
True if the result has a value or an exception, false otherwise.

◆ has_value() [1/2]

bool rpnx::result< void >::has_value ( ) const
inline

Checks if the result has a value.

Returns
True if the result has a value, false otherwise.

◆ has_value() [2/2]

bool rpnx::result< void >::has_value ( ) const
inline

Checks if the result has a value (void).

Returns
True if the result has a value, false otherwise.

◆ operator bool() [1/2]

rpnx::result< void >::operator bool ( ) const
inline

Implicit conversion to bool.

Returns
True if the result has a value or an exception, false otherwise.

◆ operator bool() [2/2]

rpnx::result< void >::operator bool ( ) const
inline

Implicit conversion to bool.

Returns
True if the result has a value or an exception, false otherwise.

◆ set_error() [1/2]

void rpnx::result< void >::set_error ( std::exception_ptr er)
inline

Sets the exception of the result.

Parameters
erThe exception to set.

◆ set_error() [2/2]

void rpnx::result< void >::set_error ( std::exception_ptr er)
inline

Sets the exception of the result.

Parameters
erThe exception to set.

◆ set_exception() [1/2]

void rpnx::result< void >::set_exception ( std::exception_ptr er)
inline

Alias for set_error().

Parameters
erException to store.

◆ set_exception() [2/2]

void rpnx::result< void >::set_exception ( std::exception_ptr er)
inline

Alias for set_error().

Parameters
erException to store.

◆ set_value()

void rpnx::result< void >::set_value ( void t)
inline

Sets the value of the result.

Parameters
tThe value to set.

◆ test() [1/2]

void rpnx::result< void >::test ( ) const
inline

Tests if the result contains an exception and rethrows it if present.

Exceptions
Thestored exception if present.

◆ test() [2/2]

void rpnx::result< void >::test ( ) const
inline

Tests if the result contains an exception and rethrows it if present.

Exceptions
Thestored exception if present.

◆ value() [1/5]

void & rpnx::result< void >::value ( ) &
inline

Alias for get().

Returns
A mutable reference to the stored value.

◆ value() [2/5]

void && rpnx::result< void >::value ( ) &&
inline

Alias for rvalue-qualified get().

Returns
An rvalue reference to the stored value.

◆ value() [3/5]

void rpnx::result< void >::value ( ) const
inline

Alias for get().

Exceptions
Thestored exception or std::logic_error when incomplete.

◆ value() [4/5]

void const & rpnx::result< void >::value ( ) const &
inline

Alias for get().

Returns
An immutable reference to the stored value.

◆ value() [5/5]

void const && rpnx::result< void >::value ( ) const &&
inline

Alias for const rvalue-qualified get().

Returns
An immutable rvalue reference to the stored value.

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