SimGrid  3.21
Versatile Simulation of Distributed Systems
simgrid::xbt::Result< T > Class Template Reference

Detailed Description

template<class T>
class simgrid::xbt::Result< T >

A value or an exception (or nothing)

This is similar to optional<expected<T>>` but it with a Future/Promise like API.

Also the name is not so great.

#include <future.hpp>

Public Member Functions

 Result ()
 
 ~Result ()
 
 Result (Result const &that)
 
Resultoperator= (Result const &that)
 
 Result (Result &&that)
 
Resultoperator= (Result &&that)
 
bool is_valid () const
 
void reset ()
 
void set_exception (std::exception_ptr e)
 
void set_value (T &&value)
 
void set_value (T const &value)
 
get ()
 Extract the value from the future. More...
 

Constructor & Destructor Documentation

◆ Result() [1/3]

template<class T>
simgrid::xbt::Result< T >::Result ( )
inline

◆ ~Result()

template<class T>
simgrid::xbt::Result< T >::~Result ( )
inline

◆ Result() [2/3]

template<class T>
simgrid::xbt::Result< T >::Result ( Result< T > const &  that)
inline

◆ Result() [3/3]

template<class T>
simgrid::xbt::Result< T >::Result ( Result< T > &&  that)
inline

Member Function Documentation

◆ operator=() [1/2]

template<class T>
Result& simgrid::xbt::Result< T >::operator= ( Result< T > const &  that)
inline

◆ operator=() [2/2]

template<class T>
Result& simgrid::xbt::Result< T >::operator= ( Result< T > &&  that)
inline

◆ is_valid()

template<class T>
bool simgrid::xbt::Result< T >::is_valid ( ) const
inline

◆ reset()

template<class T>
void simgrid::xbt::Result< T >::reset ( )
inline

◆ set_exception()

template<class T>
void simgrid::xbt::Result< T >::set_exception ( std::exception_ptr  e)
inline

◆ set_value() [1/2]

template<class T>
void simgrid::xbt::Result< T >::set_value ( T &&  value)
inline

◆ set_value() [2/2]

template<class T>
void simgrid::xbt::Result< T >::set_value ( T const &  value)
inline

◆ get()

template<class T>
T simgrid::xbt::Result< T >::get ( )
inline

Extract the value from the future.

After this, the value is invalid.

Member Data Documentation

◆ value_

template<class T>
T simgrid::xbt::Result< T >::value_

◆ exception_

template<class T>
std::exception_ptr simgrid::xbt::Result< T >::exception_

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