std::experi...~scope_fail(3)
okay so bestie, this is the std::experi...~scope_fail(3) page from the C++ Standard Libary manual β yes, we are in the C++ corner of the group chat. Itβs all about the destructor std::experimental::scope_fail::~scope_fail, and itβs short, sweet, and lowkey giving cleanup main character energy. π
π NAME π
std::experimental::scope_fail::~scope_fail β thatβs the whole name, and then it literally repeats itself: std::experimental::scope_fail::~scope_fail. Itβs giving βI said what I saidβ energy, and honestly? Iconic. β¨
β¨ Synopsis β¨
~scope_fail() noexcept; (library fundamentals TS v3)
So this destructor is noexcept. When it runs, it calls the exit function if the result of std::uncaught_exceptions() is greater than the counter of uncaught exceptions β typically on stack unwinding β and the scope_fail is active. Then it destroys the stored EF (if it is a function object) and any other non-static data members. Cleanup slay, fr fr. π§Ήπ
π¦ Notes π¦
Hereβs the vibe check: 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_fail. Thatβs literally the detection mechanism, no cap. π
π See also π
releaseβ makes thescope_failinactive (public member function). Obsessed with a clean exit? This is your girl. π«Ά
xoxo, your Unix bestie π β source/version: http://cppreference.com, dated 2024.06.10, and the page title was std::experi...~scope_fail(3). Periodt. π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms