Hi
I have been playing around with lambda2 to see what I can do.
I have an example from http://www.enseignement.polytechnique.fr/informatique/INF478/docs/Cpp/en/cpp... where the task is to increment an array of integers:
std::vectorhttp://www.enseignement.polytechnique.fr/informatique/INF478/docs/Cpp/en/cpp...<int> nums{3, 4, 2, 9, 15, 267};
std::for_each(nums.begin(), nums.end(), [](int &n){ n++; });
The nearest I can get with lambda2 is this:
std::for_each( nums.begin(),nums.end(), (_1 + 1) );
This compiles although I have found no way to store back the result.
John Fletcher
std::for_each - cppreference.com - polytechniquehttp://www.enseignement.polytechnique.fr/informatique/INF478/docs/Cpp/en/cpp...
Applies the given function object f to the result of dereferencing every iterator in the range [first, last), in order.. If InputIt is a mutable iterator, f may modify the elements of the range through the dereferenced iterator. If f returns a result, the result is ignored.
www.enseignement.polytechnique.fr
________________________________
From: Boost
I also forgot operator[].
Must be a member. Unary *, however, probably needs to be added. *_1 < *_2 is a common case. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost