This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++17 status.
std::move in [alg.foreach]Section: 26.6.5[alg.foreach]Status:C++17Submitter: Jonathan WakelyOpened: 2016-07-15Last modified: 2017-07-30
Priority:0
View otheractive issues in [alg.foreach].
View all otherissues in [alg.foreach].
View all issues withC++17 status.
Discussion:
26.6.5[alg.foreach] p3 saysReturns:std::move(f).
f is a function parameter overload resolution to select the constructor for the return value is first performed as if for an rvalue, so thestd::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 tof, which would prevent it being treated as an rvalue. We should discuss it.[2016-07 Chicago]
Monday: P0 - tentatively ready
Proposed resolution:
This wording is relative to N4606.
Change 26.6.5[alg.foreach] as indicated:
template<class InputIterator, class Function> Function for_each(InputIterator first, InputIterator last, Function f);[…]
-3-Returns:.[…]std::move(f)