If i is a Random Access Iterator, the function uses once operator+ or operator-, otherwise, the function uses repeatedly the increase or decrease operator (operator++ or operator--) until n elements have been advanced.
Parameters
- i
- Iterator to be advanced.
- n
- Number of elements to advance.
This can only be negative for random access and bidirectional iterators.
Distance is any numerical type able to represent distances between iterators of this type.
Return value
noneExample
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Output
The sixth element in mylist is: 50 |
Complexity
Constant for random access iterators.Linear on n for other categories of iterators.
See also
| distance | Return distance between iterators (function template) |
| iterator | Iterator definitions (header) |
