54template <
typename TLambda>
65 moved.m_is_released =
true;
112template <
typename TLambda>
A Lambda to be called at scope exit.
Definition: scope_guard.h:55
bool m_is_released
If true the cleanup is not going to be called.
Definition: scope_guard.h:96
Scope_guard(Scope_guard< TLambda > &&moved)
Definition: scope_guard.h:60
Scope_guard(const Scope_guard< TLambda > &)=delete
void release()
Releases the scope guard.
Definition: scope_guard.h:79
void reset()
Calls the cleanup lambda and releases the scope guard.
Definition: scope_guard.h:87
Scope_guard(const TLambda &cleanup_lambda)
Definition: scope_guard.h:57
~Scope_guard()
Definition: scope_guard.h:67
const TLambda m_cleanup_lambda
The cleanup to be called.
Definition: scope_guard.h:98
Template class to scope guard variables.
Definition: scope_guard.h:121
T & m_var_ref
Definition: scope_guard.h:135
Variable_scope_guard(Variable_scope_guard &&)=delete
Variable_scope_guard & operator=(const Variable_scope_guard &)=delete
Variable_scope_guard & operator=(Variable_scope_guard &&)=delete
T m_var_val
Definition: scope_guard.h:136
Variable_scope_guard(const Variable_scope_guard &)=delete
Variable_scope_guard(T &var)
Definition: scope_guard.h:124
Variable_scope_guard()=delete
~Variable_scope_guard()
Definition: scope_guard.h:132
Scope_guard< TLambda > create_scope_guard(const TLambda rollback_lambda)
Create a scope guard object.
Definition: scope_guard.h:113