Browse Source

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.
nce_cpp
Lioncash 7 years ago
parent
commit
32e7264142
  1. 2
      src/common/scope_exit.h

2
src/common/scope_exit.h

@ -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

Loading…
Cancel
Save