std::promise::~promise(3)

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

🌸 NAME 🌸

std::promise::~promise β€” std::promise::~promise. Yep, bestie, this is the std::promise::~promise(3) page from the C++ Standard Libary manual, and it's the destructor's whole little moment. πŸ’…


πŸ¦‹ Synopsis πŸ¦‹

~promise();  (since C++11)

Okay so ~promise(); has been around since C++11, and its vibe is: Abandons the shared state: πŸ’–

Here's the tea:

  • If the shared state is ready, it releases it.
  • If the shared state is not ready, it stores an exception object of type std::future_error with an error condition std::future_errc::broken_promise, makes the shared state ready, and releases it. 😭πŸ”₯
No cap: the "not ready" path is the dramatic one β€” it gets that std::future_error with std::future_errc::broken_promise, then the shared state is made ready and released. The ready path just gets released. Periodt. πŸ’€βœ¨

xoxo, your Unix bestie πŸ«ΆπŸ’– β€” this cutie came from http://cppreference.com, version/date 2024.06.10. πŸŽ€πŸŒˆ

πŸ“¦ where this page comes from