Generalized scope guard template

Synopsis

Declared in <beman/scope/scope.hpp>

template<
    class ScopeExitFunc,
    class InvokeChecker,
    exception_during_construction_behaviour ConstructionExceptionBehavior>
class scope_guard<ScopeExitFunc, InvokeChecker, ConstructionExceptionBehavior>;

Member Functions

Name

Description

scope_guard [constructor] [deleted]

Constructors

~scope_guard [destructor]

Invokes the exit function when the checker says the guard is still active.

operator= [deleted]

Assignment operators

invoke_checker

Returns the invocation checker stored by this guard.

release

Disables invocation of the exit function for this guard.

Template Parameters

Name

Description

ScopeExitFunc

callable invoked when the guard is active at scope exit.

InvokeChecker

callable that decides whether ScopeExitFunc is invoked.

ConstructionExceptionBehavior

behavior when construction of the guard fails.