Inheritance diagram for OLIterator:
Public Member Functions
|Assign an object to the position in the controlled sequence to which this iterator refers. |
|Make a copy of this iterator. |
|Dereference the iterator. |
|Return whether this object is equal to another one. |
Static Public Member Functions
|Advance the iterator by a certain distance. |
|Compute the distance that exists between two iterators. |
Iterators exist to travsere the objects that are held in containers. All iterators share the ability retrieve a reference to the object to which they point and to assign an object to the iterator's position in its container. How they differ is in how they are able to move through their containers. Some iterators can only go forward (OLForwardIterator), some can go forward and backward (OLBidirectionalIterator), and some can move at will (OLRandomAccessIterator). Additionally there are specialized iterators for inserting elements into a container (rather than simply assigning to elements already in the container) and for reversing the motion of other iterators.
Note that by convention a pair of iterators
last describing a range of elements refers to the range
[first, last). That is, the last iterator points to a position one step beyond the range under consideration.
|+ (void) advanceIterator:||(OLIterator *)||itor|
Advance the iterator by a certain distance.
The message tests the iterator for its type and chooses the most efficient method available for advancing the iterator. If the iterator is not a type of OLRandomAccessIterator, then its advance or reverse messages will simply be sent enough to times to complete the operation. If the iterator cannot support the operation, for example if count is negative and the iterator is not a OLBidirectionalIterator, then the message will simply return.
|itor||the iterator to advance|
|count||the number of positions to advance (or reverse) the iterator|
|- (id) assign:||(id)||object|
Assign an object to the position in the controlled sequence to which this iterator refers.
The object currently at the position will be removed and replaced with the given object.
|object||the object to assign|
Reimplemented in OLDequeIterator, OLReverseBidiIterator, OLBackInsertIterator, OLFrontInsertIterator, OLInsertIterator, OLAssociativeIterator, OLArrayIterator, OLHashIterator, OLListIterator, and OLBitIterator.
|- (id) copy|
|- (id) dereference|
Compute the distance that exists between two iterators.
The distance is computed using the most efficient means possible given the type of iterator. For example, random access iterators can compute distances in one step, while forward iterators must be advance multiple times to find a distance.
|first||the first in the series|
|last||the last in the series|
|- (BOOL) isEqual:||(id)||object|
Return whether this object is equal to another one.
|object||the object to test|
Reimplemented in OLDequeIterator, OLReverseBidiIterator, OLReverseRandomIterator, OLBackInsertIterator, OLFrontInsertIterator, OLInsertIterator, OLAssociativeIterator, OLArrayIterator, OLHashIterator, OLListIterator, and OLBitIterator.