diff options
Diffstat (limited to 'app/source/Cplt/Utils/ScopeGuard.hpp')
-rw-r--r-- | app/source/Cplt/Utils/ScopeGuard.hpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/app/source/Cplt/Utils/ScopeGuard.hpp b/app/source/Cplt/Utils/ScopeGuard.hpp index f2b7f46..e7db2a4 100644 --- a/app/source/Cplt/Utils/ScopeGuard.hpp +++ b/app/source/Cplt/Utils/ScopeGuard.hpp @@ -5,8 +5,7 @@ #include <utility> template <class TCleanupFunc> -class ScopeGuard -{ +class ScopeGuard { private: TCleanupFunc mFunc; bool mDismissed = false; @@ -19,19 +18,16 @@ 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; } }; |