:relfileprefix: ../../ [#495B5F82508DA7FA221DB7293833EA9D9EC6AF4E] = Class scope_fail pass:v,q[Scope exit guard that invokes a function upon leaving the scope with] pass:v,q[a failure condition satisfied.] == Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- template< typename Func, typename Cond = xref:boost/scope/exception_checker.adoc[exception_checker]> class scope_fail : public xref:boost/scope/scope_exit-0a.adoc[scope_exit]; ---- == Member Functions [,cols=2] |=== |Name |Description |xref:boost/scope/scope_exit-0a/active.adoc[`pass:v[active]`] | pass:v,q[Returns] `true` pass:v,q[if the scope guard is active, otherwise] `false.` |xref:boost/scope/scope_exit-0a/operator_assign.adoc[`pass:v[operator=]`] | |xref:boost/scope/scope_exit-0a/release.adoc[`pass:v[release]`] | pass:v,q[Deactivates the scope guard.] |xref:boost/scope/scope_fail-04/2constructor.adoc[`pass:v[scope_fail]`] | |xref:boost/scope/scope_exit-0a/set_active.adoc[`pass:v[set_active]`] | pass:v,q[Activates or deactivates the scope guard.] |=== == Description pass:v,q[The scope guard wraps two function objects: the scope guard action and] pass:v,q[a failure condition for invoking the action. Both function objects must] pass:v,q[be callable with no arguments and can be one of:] * pass:v,q[A user-defined class with a public `operator()`.] * pass:v,q[An lvalue reference to such class.] * pass:v,q[An lvalue reference or pointer to function taking no arguments.] pass:v,q[The condition function object `operator()` must return a value] pass:v,q[contextually convertible to] `true,` pass:v,q[if the failure is detected and the] pass:v,q[action function object is allowed to be executed, and] `false` pass:v,q[otherwise.] pass:v,q[Additionally, the failure condition function object `operator()` must not] pass:v,q[throw, as otherwise the action function object may not be called. If not] pass:v,q[specified, the default failure condition checks whether the scope is left] pass:v,q[due to an exception - the action function object will not be called if] pass:v,q[the scope is left normally.]