std::experi...hared_future(3)
std::experi...hared_future(3) π
Bestie, this is the manual page for std::experimental::shared_future::shared_future, pulled from the C++ Standard Libary (yes, the header spells it "Libary" β iconic typo, no notes π). It's the constructor page for the experimental shared_future, and we're about to go through every overload like a group-chat recap. π«Ά
πΈ NAME πΈ
std::experimental::shared_future::shared_future β literally the constructors for std::experimental::shared_future, same name twice because that's how constructors roll. Periodt. π
β¨ SYNOPSIS β¨
shared_future() noexcept;
(1)
shared_future( std::experimental::shared_future<T>&& f ) noexcept;
(2)
shared_future( const std::experimental::shared_future<T>& f );
(3)
shared_future(
std::experimental::future<std::experimental::shared_future<T>> (4)
&& other ) noexcept;
shared_future( std::experimental::future<T>&& f ) noexcept;
(5)
Here's the tea on each numbered constructor, no skipping:
- Default constructor. Constructs an empty
shared_futureobject that does not refer to a shared state. It's giving "empty and unbothered." β¨ - Constructs a
shared_futureobject, transferring the shared state held byf, if any. After construction,f.valid()isfalse. Sofhands over the state and is left invalid β no cap. π«Ά - Constructs a shared future that refers to the same shared state as
f, if any. Same state, shared vibes. π - Unwrapping constructor. Constructs a
shared_futureobject from the shared state referred to byother, if any. Ifother.valid() == falseprior to this call, the constructedshared_futureobject is empty. Otherwise, the resultingshared_futureobject becomes ready when one of these happens:otherandother.get()are both ready. The value or exception fromother.get()is stored in the shared state associated with the resultingshared_futureobject.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 resultingshared_futureobject. After this constructor returns,valid()is equal to the value ofother.valid()prior to this call, andother.valid() == false. That's the whole unwrapping saga, bestie. π
- Constructs a
shared_futureobject, transferring the shared state held byf, if any. After construction,f.valid()isfalse. Basically overload 2's energy, but withstd::experimental::future<T>&& f. π₯
π PARAMETERS π
fβ another future object to initialize with.otherβ astd::experimental::futureobject to unwrap.
π¦ EXAMPLE π¦
Ok so this section is incomplete, and the reason is literally "no example":
This section is incomplete Reason: no example
No example bestie, not even a little one. π
π DEFECT REPORTS π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards. Here's the one on this page, kept cute but factual:
- 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 the future object (public member function ofstd::shared_future<T>).
π CATEGORY π
Todo no example
Signed with sparkles by http://cppreference.com, version/date 2024.06.10, for page std::experi...hared_future(3) πβ¨
π¦ 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