std::promise

From Cppreference

Jump to: navigation, search
Defined in header <future>

template< class T > class promise;
(1) (C++11 feature)
template< class T > class promise<T&>;
(2) (C++11 feature)
template<>          class promise<void>;
(3) (C++11 feature)

The class template std::promise provides a facility to store a value that is later acquired asynchronously via a std::future object, that the std::promise can supply.


Contents

[edit] Member functions

(constructor)
constructs the promise object
(public member function)
(destructor)
destructs the promise object
(public member function)
operator=
moves the promise object
(public member function)
swap
swaps two promise objects
(public member function)
Getting the result
get_future
returns a future associated with the promised result
(public member function)
Setting the result
set_value
sets the result to specific value
(public member function)
set_value_at_thread_exit
sets the result to specific value while delivering the notification only at thread exit
(public member function)
set_exception
sets the result to indicate an exception
(public member function)
set_exception_at_thread_exit
sets the result to indicate an exception while delivering the notification only at thread exit
(public member function)

[edit] Non-member functions