std for each

suggest change
template<class InputIterator, class Function>
    Function for_each(InputIterator first, InputIterator last, Function f);

Effects:

Applies f to the result of dereferencing every iterator in the range [first, last) starting from first and proceeding to last - 1.

Parameters:

first, last - the range to apply f to.

f - callable object which is applied to the result of dereferencing every iterator in the range [first, last).

Return value:

f (until C++11) and std::move(f) (since C++11).

Complexity:

Applies f exactly last - first times.

Example:

std::vector<int> v { 1, 2, 4, 8, 16 };
std::for_each(v.begin(), v.end(), [](int elem) { std::cout << elem << " "; });

Applies the given function for every element of the vector v printing this element to stdout.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Standard library algorithms:
* std for each

Table Of Contents
8 Arrays
11 Loops
39 Streams
51 Unions
56 Lambdas
60 SFINAE
62 RAII
67 Sorting
84 RTTI
85 Standard library algorithms
87 Scopes
104 Profiling
107 Recursion
117 Iteration
125 Alignment
134 Semaphore
136 Debugging
139 Mutexes
142 decltype