tvl-depot/third_party/nix/src/libutil/finally.hh
Vincent Ambo 0f2cf531f7 style(3p/nix): Reformat project in Google C++ style
Reformatted with:

    fd . -e hh -e cc | xargs clang-format -i
2020-05-17 16:31:57 +01:00

13 lines
243 B
C++

#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(); }
};