This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.
Section: 27.6.5 [alg.foreach] Status: C++17 Submitter: Jonathan Wakely Opened: 2016-07-15 Last modified: 2017-07-30
View all other issues in [alg.foreach].
View all issues with C++17 status.
27.6.5 [alg.foreach] p3 says Returns: std::move(f).[class.copy] says that since f is a function parameter overload resolution to select the constructor for the return value is first performed as if for an rvalue, so the std::move is redundant. It could be argued that it isn't entirely redundant, because it says that implementations can't do something slightly different like return an lvalue reference that is bound to f, which would prevent it being treated as an rvalue. We should discuss it.
Monday: P0 - tentatively ready
This wording is relative to N4606.
Change 27.6.5 [alg.foreach] as indicated:
template<class InputIterator, class Function> Function for_each(InputIterator first, InputIterator last, Function f);
std::move(f ). […]