util/ScopeExit: add noexcept
This commit is contained in:
parent
2ab03a0914
commit
70b451db7b
@ -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));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user