The behavior of this template function is equivalent to:
| 1 2 3 4 5 6 |
|
Parameters
- first, last
- Input iterators to the initial and final positions in a sequence. The range used is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last.
- f
- Unary function taking an element in the range as argument. This can either be a pointer to a function or an object whose class overloads operator().
Its return value, if any, is ignored.
Return value
The same as f.Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
Output:
myvector contains: 10 20 30 myvector contains: 10 20 30 |
Complexity
Linear: Applies f once to each element.See also
| transform | Apply function to range (function template) |
| find | Find value in range (function template) |
| search | Find subsequence in range (function template) |
