GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||
GeezerVison is showing cplusplus.com — std::future Reference
<future>
future
class template
<future>
std::futuretemplate <class T> future;template <class R&> future<R&>; // specialization : T is a reference type (R&)template <> future<void>; // specialization : T is void Future
"Valid" futures are future objects associated to a shared state, and are constructed by calling one of the following functions: future objects are only useful when they are valid. Default-constructed future objects are not valid (unless move-assigned a valid future). Calling future::get on a valid future blocks the thread until the provider makes the shared state ready (either by setting a value or an exception to it). This way, two threads can be synchronized by one waiting for the other to set a value. The lifetime of the shared state lasts at least until the last object with which it is associated releases it or is destroyed. Therefore, if associated to a future, the shared state can survive the object from which it was obtained in the first place (if any). Member functions
Template specializationsTwo specific future specializations are declared in <future>:
Example
Possible output (may take more or less time):
Home page | Privacy policy
© cplusplus.com, 2000-2026 - All rights reserved - v3.3.4s Spotted an error? contact us | |||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |