std::experi...ope_success(3)

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

okay so bestie, welcome to the std::experi...ope_success(3) page from the C++ Standard Libary man page β€” yes, that's the manual name, typo and all πŸ’… this is the std::experimental::scope_success destructor and she is very specific about when she fires.


✨ NAME ✨

std::experimental::scope_success::~scope_success β€” std::experimental::scope_success::~scope_success πŸŽ€

πŸ¦‹ Synopsis πŸ¦‹

The destructor signature is literally this, bestie:

~scope_success() noexcept(noexcept(std::declval<EF&>()()));

It's tagged (library fundamentals TS v3) 🌸

Here's the vibe: it calls the exit function if the result of std::uncaught_exceptions() is less than or equal to the counter of uncaught exceptions (typically on normal exit) and the scope_success is active. Then it destroys the stored EF (if it is a function object) and any other non-static data members. periodt. πŸ’…

πŸ’– Exceptions πŸ’–

Throws any exception thrown by calling the exit function. no cap 😭

πŸŽ€ Notes πŸŽ€

Whether the destructor is called on stack unwinding can be detected by the comparison of the result of std::uncaught_exceptions() and the counter of uncaught exceptions in the scope_success. πŸ¦‹

Unlike other classes or class template specializations in the C++ standard library and other C++ TR/TS's, scope_success's destructor is permitted to throw an exception. Yes, really β€” she's built different πŸ‘‘βœ¨

🌈 See also 🌈

  • release makes the scope_success inactive (public member function) β€” iconic little switch-up πŸ’–

This adorable little page came from http://cppreference.com, dated 2024.06.10 β€” that's the source and date from the footer, bestie, and yes the whole thing is giving C++ Standard Libary energy πŸ«ΆπŸ’…πŸŒΈ

πŸ“¦ where this page comes from