std::for_each
From cppreference.com
Template:cpp/algorithm/sidebar Template:ddcl list begin <tr class="t-dsc-header">
<td>Defined in header
</td>
<algorithm>
<td></td> <td></td> </tr> <tr class="t-dcl ">
<td class="t-dcl-nopad">template< class InputIterator, class UnaryFunction >
UnaryFunction for_each( InputIterator first, InputIterator last, UnaryFunction f );
</td>
UnaryFunction for_each( InputIterator first, InputIterator last, UnaryFunction f );
<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end
Applies the given function object f
to the result of dereferencing every iterator in the range [first, last)
, in order. If InputIterator
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.
Contents |
Parameters
first, last | - | the range to apply the function to |
f | - | the unary function object to be applied (MoveConstructible in (C++11)) |
Return value
The function that was applied, f
Template:mark pre c++11 version
The result of Template:cpp Template:mark c++11 version
Complexity
linear in the distance between first
and last