|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
| Getting the result | ||||
shared_future::get | ||||
| State | ||||
Main template | ||
const T& get()const; | (1) | (since C++11) |
std::shared_future<T&> specializations | ||
T& get()const; | (2) | (since C++11) |
std::shared_future<void> specialization | ||
void get()const; | (3) | (since C++11) |
Theget member function waits (by callingwait()) until the shared state is ready, then retrieves the value stored in the shared state (if any).
Ifvalid() isfalse before the call to this function, the behavior is undefined.
Contents |
If an exception was stored in the shared state referenced by the future (e.g. via a call tostd::promise::set_exception()) then that exception will be thrown.
The C++ standard recommends the implementations to detect the case whenvalid() isfalse before the call and throw astd::future_error with an error condition ofstd::future_errc::no_state.
| This section is incomplete Reason: no example |
| checks if the future has a shared state (public member function)[edit] |