diff options
Diffstat (limited to 'louloulibs/utils/scopeguard.hpp')
-rw-r--r-- | louloulibs/utils/scopeguard.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/louloulibs/utils/scopeguard.hpp b/louloulibs/utils/scopeguard.hpp index ee1e2ef..cd0e89e 100644 --- a/louloulibs/utils/scopeguard.hpp +++ b/louloulibs/utils/scopeguard.hpp @@ -1,6 +1,7 @@ #pragma once #include <functional> +#include <memory> #include <vector> /** @@ -85,5 +86,11 @@ private: }; +template<typename F> +auto make_scope_guard(F&& f) +{ + return std::unique_ptr<void, std::decay_t<F>>{(void*)1, std::forward<F>(f)}; +} + } |