beautypg.com

HP Integrity NonStop H-Series User Manual

Page 25

background image

for the purpose. In either case, it is not proper to dereference an iterator that is being used to
specify the end of a range.

Just as with conventional pointers, the fundamental operation used to modify an iterator is the
increment operator (operator ++). When the increment operator is applied to an iterator that
denotes the final value in a sequence, it will be changed to the "past the end" value. An iterator j
is said to be reachable from an iterator i if, after a finite sequence of applications of the
expression ++i, the iterator i becomes equal to j.

Iterator Ranges

Ranges can be used to describe the entire contents of a container, by constructing an iterator to
the initial element and a special "ending" iterator. Ranges can also be used to describe
subsequences within a single container, by employing two iterators to specific values.
Whenever two iterators are used to describe a range it is assumed, but not verified, that the
second iterator is reachable from the first. Errors can occur if this expectation is not satisfied.

In the remainder of this section we will describe the different forms of iterators used by the
standard library, as well as various other iterator-related functions.

This manual is related to the following products: