aboutsummaryrefslogtreecommitdiff
path: root/core/src/Utils/ScopeGuard.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/Utils/ScopeGuard.hpp')
-rw-r--r--core/src/Utils/ScopeGuard.hpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/src/Utils/ScopeGuard.hpp b/core/src/Utils/ScopeGuard.hpp
index ed8d4ea..28ffd0b 100644
--- a/core/src/Utils/ScopeGuard.hpp
+++ b/core/src/Utils/ScopeGuard.hpp
@@ -5,7 +5,8 @@
#include <utility>
template <class TCleanupFunc>
-class ScopeGuard {
+class ScopeGuard
+{
private:
TCleanupFunc mFunc;
bool mDismissed = false;
@@ -18,16 +19,19 @@ public:
/// would work. It is highly discourage and unlikely that one would want to use ScopeGuard as a function
/// parameter, so the normal argument that implicit conversion are harmful doesn't really apply here.
ScopeGuard(TCleanupFunc func)
- : mFunc{ std::move(func) } {
+ : mFunc{ std::move(func) }
+ {
}
- ~ScopeGuard() {
+ ~ScopeGuard()
+ {
if (!mDismissed) {
mFunc();
}
}
- void Dismiss() noexcept {
+ void Dismiss() noexcept
+ {
mDismissed = true;
}
};