std::experi...::scope_fail(3)
π std::experimental::scope_fail::scope_fail π
okay bestie, welcome to the C++ Standard Libary manual page for std::experimental::scope_fail::scope_fail β manual name: std::experi...::scope_fail(3). it's giving constructor lore β¨
β¨ NAME β¨
std::experimental::scope_fail::scope_fail β literally std::experimental::scope_fail::scope_fail. the constructor. iconic. π
π¦ Synopsis π¦
template< class Fn >
explicit scope_fail( Fn&& fn ) noexcept(/*see (1) (library
fundamentals TS v3)
below*/);
scope_fail( scope_fail&& other ) noexcept(/*see (2) (library
fundamentals TS v3)
below*/);
scope_fail( const scope_fail& ) = delete; (3) (library
fundamentals TS v3)
Creates a scope_fail from a function, a function object or another scope_fail. let's break it down, bestie π«Ά
- the function / function-object constructor β Initializes the exit function with a function or function object, and initializes the counter of uncaught exceptions as if with
std::uncaught_exceptions(). The constructedscope_failis active. IfFnis not an lvalue reference type andstd::is_nothrow_constructible_v<EF, Fn>istrue, the storedEFis initialized withstd::forward<Fn>(fn); otherwise it is initialized withfn. If initialization of the storedEFthrows an exception, callsfn(). This overload participates in overload resolution only ifstd::is_same_v<std::remove_cvref_t<Fn>, scope_fail>isfalseandstd::is_constructible_v<EF, Fn>istrue. The program is ill-formed if function call expressionfn()is ill-formed. The behavior is undefined if callingfn()throws an exception or results in undefined behavior, even iffnhas not been called. π - move constructor β Move constructor. Initializes the stored
EFwith the one inother, and initializes the counter of uncaught exceptions with the one inother. The constructedscope_failis active if and only ifotheris active before the construction. Ifstd::is_nothrow_move_constructible_v<EF>istrue, initializes storedEF(denoted byexitfun) withstd::forward<EF>(other.exitfun), otherwise initializes it withother.exitfun. After successful move construction,other.release()is called andotherbecomes inactive. This overload participates in overload resolution only ifstd::is_nothrow_move_constructible_v<EF>istrueorstd::is_copy_constructible_v<EF>istrue. The behavior is undefined if:std::is_nothrow_move_constructible_v<EF>istrueandEFdoes not meet the requirements ofMoveConstructible, orstd::is_nothrow_move_constructible_v<EF>isfalseandEFdoes not meet the requirements ofCopyConstructible.
- copy constructor is deleted β
scope_failis notCopyConstructible. periodt.
πΈ Parameters πΈ
fnβ function or function object used for initializing the storedEF.otherβscope_failto move from.
π₯ Exceptions π₯
Any exception thrown during the initialization of the stored EF.
noexceptspecification:
noexcept(std::is_nothrow_constructible_v<EF, Fn> ||
std::is_nothrow_constructible_v<EF, Fn&>)
noexceptspecification:
noexcept(std::is_nothrow_move_constructible_v<EF> ||
std::is_nothrow_copy_constructible_v<EF>)
π Example π
This section is incomplete Reason: no example
π See also π
uncaught_exceptionuncaught_exceptionsβ checks if exception handling is currently in progress (removed in C++20) (function) (C++17)releaseβ makes thescope_failinactive (public member function)
π Categories π
- conditionally
noexcept - Todo no example
made with π by http://cppreference.com Β· version/date 2024.06.10 Β· page std::experi...::scope_fail(3) Β· byeee bestie πβ¨
π¦ 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