std::experi...ture::future(3)
std::experi...ture::future(3) ๐
okay so bestie, this is the std::experi...ture::future(3) page from the C++ Standard Libary (yes, that spelling is literally in the source, not me ๐ญ). It's all about the std::experimental::future::future constructor, and the whole vibe is "constructing futures, not crypto futures" ๐ฎโจ.
๐ธ NAME ๐ธ
std::experimental::future::future โ std::experimental::future::future
โจ Synopsis โจ
here's the synopsis, bestie โ read it like a text from your most organized friend ๐ซถ:
future() noexcept;
(1)
future( std::experimental::future<T>&& f ) noexcept;
(2)
future( const std::experimental::future<T>& ) = delete;
(3)
future( std::experimental::future<std::experimental::future<T>> &&
other ) (4)
noexcept;
- (1) Default constructor. Constructs an empty
futureobject that does not refer to a shared state. - (2) Constructs a
futureobject, transferring the shared state held byf, if any. After construction,f.valid()isfalse. - (3) Copy constructor is deleted.
futurecannot be copied. like, at all ๐ - (4) Unwrapping constructor. Constructs a
futureobject from the shared state referred to byother, if any. Ifother.valid() == falseprior to this call, the constructedfutureobject is empty. Otherwise, the resultingfutureobject becomes ready when one of the following happens:otherandother.get()are both ready. The value or exception fromother.get()is stored in the shared state associated with the resultingfutureobject.otheris ready, butother.get()is invalid. An exception of typestd::future_errorwith an error condition ofstd::future_errc::broken_promiseis stored in the shared state associated with the resultingfutureobject.
After this constructor returns, valid() is equal to the value of other.valid() prior to this call, and other.valid() == false.
๐ Parameters ๐
fโ anotherfutureobject to initialize with.otherโ astd::experimental::futureobject to unwrap.
๐ฆ Example ๐ฆ
This section is incomplete. Reason: no example.
๐ฅ Defect reports ๐ฅ
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
- DR: LWG 2697 โ applied to Concurrency TS. Behavior as published: behavior of unwrapping constructor is unclear with an invalid future. Correct behavior: constructs an empty future.
๐ See also ๐
constructorโ constructs thefutureobject (public member function ofstd::future<T>).
๐ Category ๐
- Todo no example
okay bye bestie ๐ซถ this page is from http://cppreference.com, dated 2024.06.10, and it's the std::experi...ture::future(3) manual โ mwah ๐
๐ฆ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 ยท MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms