diff options
author | B Stack <bgstack15@gmail.com> | 2020-07-22 11:37:03 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-07-22 11:37:03 -0400 |
commit | c95b3937fef3e2c63768f1b3b1dc2c898f23d91d (patch) | |
tree | 10260e25ae905564f7978b83fc4e316670f987c6 /zen/scope_guard.h | |
parent | Merge branch '10.25' into 'master' (diff) | |
download | FreeFileSync-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.h | 10 |
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) { |