diff --git a/src/misc/scope_guard.h b/src/misc/scope_guard.h new file mode 100644 index 0000000..74a183d --- /dev/null +++ b/src/misc/scope_guard.h @@ -0,0 +1,13 @@ +#pragma once + +template +struct scope_exit_callback { + public: + scope_exit_callback(callback_t&& callback) : callback(std::forward(callback)) {} + ~scope_exit_callback() { + this->callback(); + } + + private: + callback_t callback; +}; \ No newline at end of file