From 4a9d8f132fe9ca3411e2e3c245922ad778c56aa0 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sat, 14 Sep 2019 14:22:15 +0200 Subject: [PATCH] Added two new commands --- src/misc/scope_guard.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/misc/scope_guard.h 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