std::experi...ture::future(3)

๐Ÿ“ฆ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

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. (1) Default constructor. Constructs an empty future object that does not refer to a shared state.
  2. (2) Constructs a future object, transferring the shared state held by f, if any. After construction, f.valid() is false.
  3. (3) Copy constructor is deleted. future cannot be copied. like, at all ๐Ÿ’€
  4. (4) Unwrapping constructor. Constructs a future object from the shared state referred to by other, if any. If other.valid() == false prior to this call, the constructed future object is empty. Otherwise, the resulting future object becomes ready when one of the following happens:
    • other and other.get() are both ready. The value or exception from other.get() is stored in the shared state associated with the resulting future object.
    • other is ready, but other.get() is invalid. An exception of type std::future_error with an error condition of std::future_errc::broken_promise is stored in the shared state associated with the resulting future object.

After this constructor returns, valid() is equal to the value of other.valid() prior to this call, and other.valid() == false.

๐ŸŽ€ Parameters ๐ŸŽ€

  • f โ€” another future object to initialize with.
  • other โ€” a std::experimental::future object 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 the future object (public member function of std::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