1
0
Fork 0
forked from suyu/suyu

common/scope_exit: Replace std::move with std::forward in ScopeExit()

The template type here is actually a forwarding reference, not an rvalue
reference in this case, so it's more appropriate to use std::forward to
preserve the value category of the type being moved.
This commit is contained in:
Lioncash 2019-04-11 20:01:31 -04:00
parent 2598433f9c
commit b569641098

View file

@ -20,7 +20,7 @@ struct ScopeExitHelper {
template <typename Func> template <typename Func>
ScopeExitHelper<Func> ScopeExit(Func&& func) { ScopeExitHelper<Func> ScopeExit(Func&& func) {
return ScopeExitHelper<Func>(std::move(func)); return ScopeExitHelper<Func>(std::forward<Func>(func));
} }
} // namespace detail } // namespace detail