Executes a function at end of current scope (in the spirit of Zig defer
keyword).
More...
#include <Deferred.h>
Public Member Functions | |
Deferred (F &&f) | |
Constructs Deferred object with a functor F. | |
~Deferred () | |
Invokes the function F upon destruction, if disarm() has not been previously called. | |
void | disarm () |
Disarms the Deferred object, preventing function invocation on destruction. | |
Executes a function at end of current scope (in the spirit of Zig defer
keyword).
F | The lambda / function to execute |
Example:
|
inline |
Constructs Deferred object with a functor F.
|
inline |
Invokes the function F upon destruction, if disarm() has not been previously called.
|
inline |
Disarms the Deferred object, preventing function invocation on destruction.