Random access iterators provide for bidirectional traversal, plus
- bidirectional "long jumps", expressed with r += n
and r -= n (where r is a random access iterator and
n is an integer)
- addition and subtraction of an integer, expressed with r + n
and r - n
- iterator subtraction, expresses as r - s (where s
is another random access iterator), producing an integer value.
- comparisons, expressed as r < s, r > s, r <=; s, r >=; s
, producing bool values.
All three categories also provide for
- testing for equality, with ==, and inequality,
with !=
- dereferencing, which means obtaining the data object at the
position the iterator refers to, expressed with *.
In addition to the requirements about how these operations are expressed,
there are laws that they must obey. Without going into the full statement of
the laws here, let us note that
Any C++ pointer type, T*, obeys all the laws of the
random access iterator category.
There are two other categories, input iterators and
output iterators, which are like forward iterators except not
all properties of forward iterators are guaranteed.