C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::async::promise< T > Class Template Reference

Provides a facility to store a value or an error that is later acquired asynchronously via a future object. More...

#include <promise.hpp>

Public Types

using value_type = std::conditional_t<std::is_void_v<T>, unit_t, T>
 

Public Member Functions

 promise (promise &&) noexcept=default
 
promiseoperator= (promise &&) noexcept=default
 
 promise (const promise &other) noexcept
 
promiseoperator= (const promise &other) noexcept
 
bool valid () const noexcept
 
 operator bool () const noexcept
 
bool operator! () const noexcept
 
void set_value (value_type value)
 
void set_error (error reason)
 
future< T > get_future () const
 

Detailed Description

template<class T>
class caf::async::promise< T >

Provides a facility to store a value or an error that is later acquired asynchronously via a future object.

A promise may deliver only one value.

Member Function Documentation

◆ get_future()

template<class T >
future< T > caf::async::promise< T >::get_future ( ) const
Precondition
valid()

◆ set_error()

template<class T >
void caf::async::promise< T >::set_error ( error reason)
Precondition
valid()

◆ set_value()

template<class T >
void caf::async::promise< T >::set_value ( value_type value)
Precondition
valid()

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