std::experimental::promise (library fundamentals TS)
From cppreference.com
< cpp | experimental | lib extensions
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Experimental
Filesystem library (filesystem TS)
Library fundamentals (library fundamentals TS)
Library fundamentals 2 (library fundamentals TS v2)
Library fundamentals 3 (library fundamentals TS v3)
Extensions for parallelism (parallelism TS)
Extensions for parallelism 2 (parallelism TS v2)
Extensions for concurrency (concurrency TS)
Extensions for concurrency 2 (concurrency TS v2)
Concepts (concepts TS)
Ranges (ranges TS)
Reflection (reflection TS)
Mathematical special functions (special functions TR)
Polymorphic allocator library
Memory resource classes
Global memory resources
Type-erased allocator support for existing classes
promise
This page is about the modified version of std::promise with type-erased allocator support provided by the Library Fundamentals TSes. For the version of promise
provided by the concurrency TS supporting the std::future
improvements made by that TS, see std::experimental::concurrency_v1::promise.
Defined in header
<experimental/future>
template< class R > class promise;
(1)
(library fundamentals TS)
template< class R > class promise<R&>;
(2)
(library fundamentals TS)
template<> class promise<void>;
(3)
(library fundamentals TS)
std::experimental::fundamentals_v1::promise
(and std::experimental::fundamentals_v2::promise
) is a modified version of std::promise provided by the library fundamentals TS with support for type-erased allocators.
Contents
[edit] Member types
Member type
Definition
allocator_type
std::experimental::erased_type
[edit] Member functions
retrieves a pointer to the memory resource used by this object to allocate memory
(public member function) [edit]
(public member function) [edit]
[edit] Non-member function
[edit] Helper classes
Members identical to std::promise
Member functions
Getting the result
returns a future associated with the promised result
(public member function of
(public member function of
std::promise<R>
) [edit]
Setting the result
sets the result to specific value while delivering the notification only at thread exit
(public member function of
(public member function of
std::promise<R>
) [edit]
sets the result to indicate an exception while delivering the notification only at thread exit
(public member function of
(public member function of
std::promise<R>
) [edit]