summaryrefslogtreecommitdiff
path: root/zen/scope_guard.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-07-22 11:37:03 -0400
committerB Stack <bgstack15@gmail.com>2020-07-22 11:37:03 -0400
commitc95b3937fef3e2c63768f1b3b1dc2c898f23d91d (patch)
tree10260e25ae905564f7978b83fc4e316670f987c6 /zen/scope_guard.h
parentMerge branch '10.25' into 'master' (diff)
downloadFreeFileSync-c95b3937fef3e2c63768f1b3b1dc2c898f23d91d.tar.gz
FreeFileSync-c95b3937fef3e2c63768f1b3b1dc2c898f23d91d.tar.bz2
FreeFileSync-c95b3937fef3e2c63768f1b3b1dc2c898f23d91d.zip
add upstream 11.0
Diffstat (limited to 'zen/scope_guard.h')
-rw-r--r--zen/scope_guard.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/zen/scope_guard.h b/zen/scope_guard.h
index 846d5663..e97d3f0a 100644
--- a/zen/scope_guard.h
+++ b/zen/scope_guard.h
@@ -60,7 +60,8 @@ template <typename F> inline
void runScopeGuardDestructor(F& fun, bool failed, std::integral_constant<ScopeGuardRunMode, ScopeGuardRunMode::onFail>) noexcept
{
if (failed)
- try { fun(); } catch (...) { assert(false); }
+ try { fun(); }
+ catch (...) { assert(false); }
}
@@ -71,9 +72,10 @@ public:
explicit ScopeGuard(const F& fun) : fun_(fun) {}
explicit ScopeGuard( F&& fun) : fun_(std::move(fun)) {}
- ScopeGuard(ScopeGuard&& other) : fun_(std::move(other.fun_)),
- exeptionCount_(other.exeptionCount_),
- dismissed_(other.dismissed_) { other.dismissed_ = true; }
+ ScopeGuard(ScopeGuard&& tmp) :
+ fun_(std::move(tmp.fun_)),
+ exeptionCount_(tmp.exeptionCount_),
+ dismissed_(tmp.dismissed_) { tmp.dismissed_ = true; }
~ScopeGuard() noexcept(runMode == ScopeGuardRunMode::onFail)
{
bgstack15