userver: utils::ResultStore< T > Class Template Reference
Loading...
Searching...
No Matches
utils::ResultStore< T > Class Template Referencefinal

#include <userver/utils/result_store.hpp>

Detailed Description

template<typename T>
class utils::ResultStore< T >

Simple value/exception store

Definition at line 19 of file result_store.hpp.

Public Member Functions

Retrieve ()
 Retrieves the stored value or rethrows the stored exception.
 
const T & Get () const &
 Returns the stored value or rethrows the stored exception.
 
void SetValue (const T &)
 Stores a value.
 
void SetValue (T &&)
 Stores a value.
 
void SetException (std::exception_ptr &&) noexcept
 Stores an exception.
 

Member Function Documentation

◆ Get()

template<typename T >
const T & utils::ResultStore< T >::Get ( ) const &

Returns the stored value or rethrows the stored exception.

Exceptions
std::logic_errorif no value/exception stored

Definition at line 76 of file result_store.hpp.

◆ Retrieve()

template<typename T >
T utils::ResultStore< T >::Retrieve ( )

Retrieves the stored value or rethrows the stored exception.

Exceptions
std::logic_errorif no value/exception stored
Note
Can be called at most once.

Definition at line 69 of file result_store.hpp.

◆ SetException()

template<typename T >
void utils::ResultStore< T >::SetException ( std::exception_ptr && exception)
noexcept

Stores an exception.

Definition at line 93 of file result_store.hpp.

◆ SetValue() [1/2]

template<typename T >
void utils::ResultStore< T >::SetValue ( const T & value)

Stores a value.

Definition at line 83 of file result_store.hpp.

◆ SetValue() [2/2]

template<typename T >
void utils::ResultStore< T >::SetValue ( T && value)

Stores a value.

Definition at line 88 of file result_store.hpp.


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