Name

advance function template — Moves iterator forward or backward

Synopsis

template <typename InputIterator, typename Distance>
  void advance(InputIterator& i, Distance n);

The advance function template advances an input iterator i by a distance n. If the iterator is bidirectional or random access, n can be negative. If the iterator is random access, the advance function is specialized as i + n; other iterators apply the ++ operator n times (or -- for a bidirectional iterator when n is negative).

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.