#pragma once #include <functional> /* A trivial class to run a function at the end of a scope. */ class Finally { private: std::function<void()> fun; public: Finally(std::function<void()> fun) : fun(fun) {} ~Finally() { fun(); } };
depot | ||
monorepo for the virus lounge | The Virus Lounge |
about summary refs log tree commit diff |
#pragma once #include <functional> /* A trivial class to run a function at the end of a scope. */ class Finally { private: std::function<void()> fun; public: Finally(std::function<void()> fun) : fun(fun) {} ~Finally() { fun(); } };