[range.iter.ops.general] (original) (raw)

24 Iterators library [iterators]

24.4 Iterator primitives [iterator.primitives]

24.4.4 Range iterator operations [range.iter.ops]

24.4.4.1 General [range.iter.ops.general]

The library includes the function templatesranges​::​advance, ranges​::​distance,ranges​::​next, and ranges​::​prevto manipulate iterators.

These operations adapt to the set of operators provided by each iterator category to provide the most efficient implementation possible for a concrete iterator type.

[Example 1:

ranges​::​advance uses the + operator to move arandom_access_iterator forward n steps in constant time.

For an iterator type that does not model random_access_iterator,ranges​::​advance instead performs n individual increments with the ++ operator.

— _end example_]