Section: 27.6.5 [alg.foreach] Status: C++17 Submitter: Jonathan Wakely Opened: 2016-07-15 Last modified: 2017-07-30 20:15:43 UTC
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 ). […]