|Categories: algorithms, iterators ||Component type: function |
template <class InputIterator, class Distance>
void advance(InputIterator& i, Distance n);
Advance(i, n) increments the iterator
i by the distance
n > 0 it is equivalent to executing
n times, and if
n < 0 it is equivalent to executing
n times. If
n == 0, the call has no effect.
Defined in the standard header iterator, and in the nonstandard backward-compatibility header iterator.h.
Requirements on types
InputIterator is a model of InputIterator.
Distance is an integral type that is convertible to
InputIterator's distance type.
Constant time if
InputIterator is a model of RandomAccessIterator, otherwise linear time.
List<int>::iterator i = L.begin();
assert(i == L.end());
distance, InputIterator, BidirectionalIterator, RandomAccessIterator,