mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 14:36:16 +02:00
14 lines
248 B
C++
14 lines
248 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(); }
|
|
};
|