diff options
Diffstat (limited to '')
-rw-r--r-- | src/common/scope_exit.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h index 08f09a8c8..072ab285d 100644 --- a/src/common/scope_exit.h +++ b/src/common/scope_exit.h @@ -4,20 +4,24 @@ #pragma once -#include "common/common_funcs.h" #include <utility> +#include "common/common_funcs.h" namespace detail { - template <typename Func> - struct ScopeExitHelper { - explicit ScopeExitHelper(Func&& func) : func(std::move(func)) {} - ~ScopeExitHelper() { func(); } +template <typename Func> +struct ScopeExitHelper { + explicit ScopeExitHelper(Func&& func) : func(std::move(func)) {} + ~ScopeExitHelper() { + func(); + } - Func func; - }; + Func func; +}; - template <typename Func> - ScopeExitHelper<Func> ScopeExit(Func&& func) { return ScopeExitHelper<Func>(std::move(func)); } +template <typename Func> +ScopeExitHelper<Func> ScopeExit(Func&& func) { + return ScopeExitHelper<Func>(std::move(func)); +} } /** |