blob: 2ead8661a6e7147e071cf92e493b20b99f6ba080 (
plain) (
tree)
|
|
#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:
explicit Finally(std::function<void()> fun) : fun(fun) {}
~Finally() { fun(); }
};
|