Namespaces
Variants
Views
Actions

std::promise

From cppreference.com
< cpp‎ | thread
Revision as of 22:28, 31 May 2013 by P12bot (Talk | contribs)

 
 
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
(C++11)
Generic lock management
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
promise
(C++11)
(C++11)
(C++11)
(C++11)
Safe Reclamation
(C++26)
Hazard Pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11)(deprecated in C++20)
(C++11)(deprecated in C++20)
Memory ordering
Free functions for atomic operations
Free functions for atomic flags
 
 
Defined in header <future>
template< class T > class promise;
(1) (since C++11)
template< class T > class promise<T&>;
(2) (since C++11)
template<>          class promise<void>;
(3) (since C++11)

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

Member functions

constructs the promise object
(public member function) [edit]
destructs the promise object
(public member function) [edit]
assigns the shared state
(public member function) [edit]
swaps two promise objects
(public member function) [edit]
Getting the result
returns a future associated with the promised result
(public member function) [edit]
Setting the result
sets the result to specific value
(public member function) [edit]
sets the result to specific value while delivering the notification only at thread exit
(public member function) [edit]
sets the result to indicate an exception
(public member function) [edit]
sets the result to indicate an exception while delivering the notification only at thread exit
(public member function) [edit]

Non-member functions

specializes the std::swap algorithm
(function template) [edit]

Helper classes

specializes the std::uses_allocator type trait
(class template specialization) [edit]