22 #ifndef CRNAtScopeExit_HEADER
23 #define CRNAtScopeExit_HEADER
38 Destroyer(
const std::function<
void(
void)> &f):atdestroy(f) { }
42 Destroyer(std::function<
void(
void)> &&f):atdestroy(std::move(f)) { }
46 std::function<void(void)> atdestroy;
55 #define CRNAtScopeExit_UNIFY_VAR(VAR) CRNAtScopeExit_UNIFY_VAR2(VAR,__LINE__)
60 #define CRNAtScopeExit_UNIFY_VAR2(VAR,CODE) CRNAtScopeExit_UNIFY_VAR3(VAR,CODE)
65 #define CRNAtScopeExit_UNIFY_VAR3(VAR,CODE) VAR##CODE
73 #define AtScopeExit(functor) crn::Destroyer CRNAtScopeExit_UNIFY_VAR(at_scope_exit)(functor)
An objects that calls a functor when destroyed.
Destroyer(std::function< void(void)> &&f)
Constructor.
~Destroyer()
Destructor that calls the functor.
Destroyer(const std::function< void(void)> &f)
Constructor.