Since only random access iterators provide
+
and
-
operators, the library provides two
function templates
advance
and
distance.

These
function templates
use
+
and
-
for random access iterators (and are, therefore, constant
time for them); for input, forward and bidirectional iterators they use
++
to provide linear time
implementations.