17 #ifndef COM_BORA_SOFTWARE__BALAU_TYPE__ON_SCOPE_EXIT 18 #define COM_BORA_SOFTWARE__BALAU_TYPE__ON_SCOPE_EXIT 38 public:
explicit OnScopeExit(std::function<
void ()> function_)
39 : function(
std::move(function_)) {}
58 public:
void rest(std::function<
void ()> function_) {
76 private: std::function<void ()>
function;
81 #endif // COM_BORA_SOFTWARE__BALAU_TYPE__ON_SCOPE_EXIT
The root Balau namespace.
Definition: ApplicationConfiguration.hpp:23
Run a function on scope exit.
Definition: OnScopeExit.hpp:34
void clear()
Set to the function to NOP (cancels scheduled execution).
Definition: OnScopeExit.hpp:51
void executeNow()
Execute the function now and then clear it.
Definition: OnScopeExit.hpp:65
OnScopeExit(std::function< void()> function_)
Run the function on scope exit.
Definition: OnScopeExit.hpp:38
~OnScopeExit()
Run the scope exit function and destroy the OnScopeExit instance.
Definition: OnScopeExit.hpp:44
void rest(std::function< void()> function_)
Set to the function to a different function (cancels previously scheduled execution).
Definition: OnScopeExit.hpp:58