|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
future::share | ||||
| Getting the result | ||||
| State | ||||
std::shared_future<T> share()noexcept; | ||
Transfers the shared state of*this, if any, to astd::shared_future object. Multiplestd::shared_future objects may reference the same shared state, which is not possible withstd::future.
After callingshare on astd::future,valid()==false.
Contents |
(none)
Astd::shared_future object containing the shared state previously held by*this, if any, constructed as if bystd::shared_future<T>(std::move(*this)).
| This section is incomplete Reason: no example |
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 2556 | C++11 | share() requiresvalid() to betrue | requirement removed and madenoexcept |
(C++11) | waits for a value (possibly referenced by other futures) that is set asynchronously (class template)[edit] |