std::promise::promise(3)

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

🌸 NAME 🌸

okay so welcome to std::promise::promise(3), bestie β€” this lives in the C++ Standard Libary manual, and the name is std::promise::promise : std::promise::promise. Yes, the icon is self-titled, we love that for her πŸ‘‘βœ¨

✨ Synopsis ✨

Here's the constructor lineup, and code is sacred so it stays exactly like this:

promise();                                           (1) (since
C++11)
template< class Alloc >                              (2) (since
C++11)
promise( std::allocator_arg_t, const Alloc& alloc );
promise( promise&& other ) noexcept;                 (3) (since
C++11)
promise( const promise& other ) = delete;            (4) (since
C++11)

Constructs a promise object. Main character energy from the jump πŸ’…

  1. (1) β€” Default constructor. Constructs the promise with an empty shared state. Clean slate vibes ✨
  2. (2) β€” Constructs the promise with an empty shared state. The shared state is allocated using alloc. Alloc must meet the requirements of Allocator. Fancy allocator moment, no cap πŸŽ€
  3. (3) β€” Move constructor. Constructs the promise with the shared state of other using move semantics. After construction, other has no shared state. She took the state and left, periodt πŸ¦‹
  4. (4) β€” promise is not copyable. Literally = delete, bestie 😭

πŸ’– Parameters πŸ’–

  • alloc β€” allocator to use to allocate the shared state.
  • other β€” another promise to acquire the state from.

🚨 Exceptions 🚨

  • 1,2) β€” May throw implementation-defined exceptions. So, like, stay aware 🌈

🌈 Example 🌈

This section is incomplete Reason: no example

Not me wanting an example and getting this πŸ˜­πŸ™ˆ

πŸŽ€ Category πŸŽ€

  • Todo no example

okay bye bestie, go construct responsibly πŸ’œ shoutout to http://cppreference.com for the source/version, dated 2024.06.10 🫢

πŸ“¦ where this page comes from