Namespaces
Variants
Views
Actions

std::promise

From cppreference.com
< cpp‎ | thread
Revision as of 14:10, 15 June 2012 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
 
 

Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <future>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td >
template< class T > class promise;
</td>

<td > (1) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template< class T > class promise<T&>;
</td>

<td > (2) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
template<>          class promise<void>;
</td>

<td > (3) </td> <td > (since C++11) </td> </tr> Template:ddcl list end

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

Template:cpp/thread/promise/dcl list constructorTemplate:cpp/thread/promise/dcl list destructorTemplate:cpp/thread/promise/dcl list operator=Template:cpp/thread/promise/dcl list swapTemplate:cpp/thread/promise/dcl list get futureTemplate:cpp/thread/promise/dcl list set valueTemplate:cpp/thread/promise/dcl list set value at thread exitTemplate:cpp/thread/promise/dcl list set exceptionTemplate:cpp/thread/promise/dcl list set exception at thread exit
Getting the result
Setting the result

Non-member functions

Template:cpp/thread/promise/dcl list swap2

Helper classes

Template:cpp/thread/promise/dcl list uses allocator