Tools.h++ Manual

104011 Tandem Computers Incorporated 23-23
23
RWGSlistIterator(type)
RWGSlistIterator(type)
|
RWSlistIterator
Synopsis
#include <rw/gslist.h>
declare(RWGSlist,
type
)
RWGSlist(
type
) a;
RWGSlistIterator(
type
) I(a);
Description Iterator for class
RWGSlist
(type), which allows sequential access to all the
elements of a singly-linked list. Elements are accessed in order, first to last.
Like all Tools.h++ iterators, the "current item" is undefined immediately after
construction—you must define it by using
operator()
or some other (valid)
operation.
Once the iterator has advanced beyond the end of the collection it is no longer
valid—continuing to use it will bring undefined results.
In order to simplify the documentation below, an imaginary typedef
typedef RWBoolean (*
yourTester
)(const
type
*, const void*);
has been used. See the documentation for class
RWGSlist
(type) for an
explanation of this function.
Public constructor
RWGSlistIterator(
type
)( RWGSlist(
type
)& list);
Construct an iterator for the
RWGSlist
(type) list. Immediately after
construction, the position of the iterator is undefined.
Public member operators type
* operator()();
Advances the iterator to the next item and returns it. Returns nil if at the end of
the collection.
void operator++();
Advances the iterator one item.
void operator+=(size_t n);
Advances the iterator
n
items.