std::future::future(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

std::future::future β€” std::future::future ✨ (yes bestie, the name section is literally the name twice, and honestly? iconic).

This page is from the C++ Standard Libary manual, section 3. We're talking constructors today, so grab your emotional support compiler πŸŽ€.

✨ Synopsis ✨

Exact synopsis, no edits, fr fr:

future() noexcept;                      (1) (since C++11)
future( future&& other ) noexcept;      (2) (since C++11)
future( const future& other ) = delete; (3) (since C++11)

Constructs a std::future object. That's the whole assignment: construct the future, slay πŸ’….

  • (1) β€” Default constructor. Constructs a std::future with no shared state. After construction, valid() == false. So it's valid-adjacent? No bestie, it's literally false β€” it's a future with no shared-state tea yet πŸ«–.
  • (2) β€” Move constructor. Constructs a std::future with the shared state of other using move semantics. After construction, other.valid() == false. The shared state has been moved out of other, and other is left invalid πŸ’¨.
  • (3) β€” std::future is not CopyConstructible. It's = delete, so copying is not the move, bestie β€” do not attempt πŸ™ˆ.

🌸 Parameters 🌸

  • other β€” another std::future to acquire shared state from. That's the only parameter, and it's giving "hand over the shared state" energy 🫢.

Source/version: http://cppreference.com Β· date: 2024.06.10 Β· page: std::future::future(3) β€” mwah, bestie πŸ’‹βœ¨

πŸ“¦ where this page comes from