Lely core libraries 2.3.4
|
A promise. More...
#include <future.hpp>
Public Types | |
using | result_type = util::Result< T, E > |
The type of the result stored in the shared state. | |
Public Member Functions | |
Promise () | |
Constructs a promise with (a reference to) an empty shared state. | |
Promise (const Promise &other) noexcept | |
Constructs a promise with a reference to the shared state of other. | |
Promise (Promise &&other) noexcept | |
Moves the shared state of other to *this . | |
Promise & | operator= (const Promise &other) noexcept |
Abandons the shared state of *this as if by ~Promise(), then creates a reference to the shared state of other. | |
Promise & | operator= (Promise &&other) noexcept |
Abandons the shared state of *this as if by ~Promise(), then moves the shared state of other to *this . | |
~Promise () | |
Abandons the shared state. | |
operator bool () const noexcept | |
Checks whether *this contains (a reference to) a shared state. | |
bool | is_unique () const noexcept |
Checks whether *this contains a unique reference to its shared state. | |
template<class U > | |
bool | set (U &&u) |
Satisfies a promise, if it was not aready satisfied, and stores the specified value as the result in the shared state. | |
Future< T, E > | get_future () const noexcept |
Returns a lely::ev::Future with (a reference to) the same shared state as *this . | |
A promise.
T and E should be nothrow default-constructible. Any exceptions thrown during the default construction of the shared state will result in a call to std::terminate().
Definition at line 60 of file future.hpp.
|
inline |
Constructs a promise with (a reference to) an empty shared state.
Definition at line 70 of file future.hpp.
|
inlinenoexcept |
Moves the shared state of other to *this
.
Definition at line 94 of file future.hpp.
Abandons the shared state.
If no references remain to the shared state, it is destroyed.
Definition at line 134 of file future.hpp.
Abandons the shared state of *this
as if by ~Promise(), then creates a reference to the shared state of other.
*this
. Definition at line 105 of file future.hpp.
|
inlinenoexcept |
Abandons the shared state of *this
as if by ~Promise(), then moves the shared state of other to *this
.
*this
; Definition at line 122 of file future.hpp.
|
inlinenoexcept |
Checks whether *this
contains a unique reference to its shared state.
Definition at line 149 of file future.hpp.
|
inline |
Satisfies a promise, if it was not aready satisfied, and stores the specified value as the result in the shared state.
Definition at line 166 of file future.hpp.
|
inlinenoexcept |
Returns a lely::ev::Future with (a reference to) the same shared state as *this
.
Definition at line 188 of file future.hpp.