Commit 7a99a700 authored by Max Kellermann's avatar Max Kellermann

util/ScopeExit: use std::exchange()

parent 70b451db
...@@ -43,9 +43,8 @@ public: ...@@ -43,9 +43,8 @@ public:
explicit ScopeExitGuard(F &&f) noexcept:F(std::forward<F>(f)) {} explicit ScopeExitGuard(F &&f) noexcept:F(std::forward<F>(f)) {}
ScopeExitGuard(ScopeExitGuard &&src) noexcept ScopeExitGuard(ScopeExitGuard &&src) noexcept
:F(std::move(src)), enabled(src.enabled) { :F(std::move(src)),
src.enabled = false; enabled(std::exchange(src.enabled, false)) {}
}
/* destructors are "noexcept" by default; this explicit /* destructors are "noexcept" by default; this explicit
"noexcept" declaration allows the destructor to throw if "noexcept" declaration allows the destructor to throw if
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment