mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 00:36:20 +02:00
f4ab297b31
`///@file` makes them show up in the internal API dos. A tiny few were missing `#pragma once`.
16 lines
234 B
C++
16 lines
234 B
C++
#pragma once
|
|
///@file
|
|
|
|
/**
|
|
* A trivial class to run a function at the end of a scope.
|
|
*/
|
|
template<typename Fn>
|
|
class Finally
|
|
{
|
|
private:
|
|
Fn fun;
|
|
|
|
public:
|
|
Finally(Fn fun) : fun(std::move(fun)) { }
|
|
~Finally() { fun(); }
|
|
};
|