for_each

template<class InIt, class Fun>
    Fun for_each(InIt first, InIt last, Fun f);

The template function evaluates f(*(first + N)) once for each N in the range [0, last - first). It then returns f. The call f(*(first + N)) must not alter *(first + N).

See the related sample program.