ADTF
|
Scope guard executing a callable object of type F
on scope exit.
More...
Public Member Functions | |
ScopeGuard (const ScopeGuard &)=delete | |
ScopeGuard & | operator= (const ScopeGuard &)=delete |
ScopeGuard & | operator= (ScopeGuard &&other)=delete |
ScopeGuard (ScopeGuard &&other) | |
ScopeGuard (F &&f) | |
Ctor. More... | |
~ScopeGuard () | |
Destroy the scope guard object and execute the callable if execution is enabled. | |
void | dismiss () noexcept |
Dismiss the execution of the callable on scope exit. | |
void | rehire () noexcept |
Rehire the execution of the callable on scope exit. | |
Private Attributes | |
bool | _enabled = true |
std::decay< F >::type | _f |
Scope guard executing a callable object of type F
on scope exit.
The callable execution can be disabled/re-enabled by using dismiss() or rehire() respectively (default: enabled).
To actually create scope guards objects, the following convenience functions are provided:
F | Type of the callable object (pointer to function, lambda, etc.) |
Definition at line 56 of file scopeguard.h.
|
inlineexplicit |
Ctor.
[in] | f | The callable object to execute on scope exit |
Definition at line 76 of file scopeguard.h.