advance
advance
template<class InIt, class Dist>
void advance(InIt& it, Dist n);
The template function effectively advances it
by incrementing it n
times. If InIt
is a random-access iterator type, the function evaluates the expression it += n
. Otherwise, it performs each increment by evaluating ++it
. If InIt
is an input or forward iterator type, n
must not be negative.
See the related sample program.