#pragma once #include class CScopeExit { public: CScopeExit() = default; explicit CScopeExit(std::function f); ~CScopeExit(); void SetFunction(std::function f); void Dismiss(); void ReEnable(); void ToggleActive(); bool IsActive() const; private: std::function func; bool active = true; };