blob: 8d3083b6a3acd34a13ca66c138c9b842c26f1020 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#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(); }
};
|