diff --git a/BAN/include/BAN/ScopeGuard.h b/BAN/include/BAN/ScopeGuard.h new file mode 100644 index 000000000..d39c12bde --- /dev/null +++ b/BAN/include/BAN/ScopeGuard.h @@ -0,0 +1,22 @@ +#pragma once + +#include + +namespace BAN +{ + + class ScopeGuard + { + public: + ScopeGuard(const BAN::Function& func) + : m_func(func) + { } + ~ScopeGuard() + { + m_func(); + } + private: + BAN::Function m_func; + }; + +} \ No newline at end of file