#pragma once #include namespace BAN { class ScopeGuard { public: ScopeGuard(const BAN::Function& func) : m_func(func) { } ~ScopeGuard() { m_func(); } private: BAN::Function m_func; }; }