blob: 47c64deaecea05af5b6e5f519124e747f2916918 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
#pragma once
/* 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(); }
};
|