util/ScopeExit: use std::exchange()
This commit is contained in:
parent
70b451db7b
commit
7a99a7008c
@ -43,9 +43,8 @@ public:
|
||||
explicit ScopeExitGuard(F &&f) noexcept:F(std::forward<F>(f)) {}
|
||||
|
||||
ScopeExitGuard(ScopeExitGuard &&src) noexcept
|
||||
:F(std::move(src)), enabled(src.enabled) {
|
||||
src.enabled = false;
|
||||
}
|
||||
:F(std::move(src)),
|
||||
enabled(std::exchange(src.enabled, false)) {}
|
||||
|
||||
/* destructors are "noexcept" by default; this explicit
|
||||
"noexcept" declaration allows the destructor to throw if
|
||||
|
Loading…
Reference in New Issue
Block a user