util/ScopeExit: add `noexcept`

This commit is contained in:
Max Kellermann 2023-05-22 14:43:36 +02:00
parent 2ab03a0914
commit 70b451db7b
1 changed files with 3 additions and 3 deletions

View File

@ -40,9 +40,9 @@ class ScopeExitGuard : F {
bool enabled = true; bool enabled = true;
public: public:
explicit ScopeExitGuard(F &&f):F(std::forward<F>(f)) {} explicit ScopeExitGuard(F &&f) noexcept:F(std::forward<F>(f)) {}
ScopeExitGuard(ScopeExitGuard &&src) ScopeExitGuard(ScopeExitGuard &&src) noexcept
:F(std::move(src)), enabled(src.enabled) { :F(std::move(src)), enabled(src.enabled) {
src.enabled = false; src.enabled = false;
} }
@ -68,7 +68,7 @@ struct ScopeExitTag {
parantheses at the end of the expression AtScopeExit() parantheses at the end of the expression AtScopeExit()
call */ call */
template<typename F> template<typename F>
ScopeExitGuard<F> operator+(F &&f) { ScopeExitGuard<F> operator+(F &&f) noexcept {
return ScopeExitGuard<F>(std::forward<F>(f)); return ScopeExitGuard<F>(std::forward<F>(f));
} }
}; };