summaryrefslogtreecommitdiffstats
path: root/src/common/scope_exit.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/scope_exit.h')
-rw-r--r--src/common/scope_exit.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h
index 08f09a8c8..73b2a262e 100644
--- a/src/common/scope_exit.h
+++ b/src/common/scope_exit.h
@@ -4,20 +4,25 @@
#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));
+}
}
/**