Tools.h++ Manual

104011 Tandem Computers Incorporated 21-7
21
RWBagIterator
RWBagIterator
|
RWIterator
Synopsis
#include <rw/rwbag.h>
RWBag b;
RWBagIterator it(b);
Description Iterator for class
RWBag
, which allows sequential access to all the elements of
RWBag
.
Note – Because a
RWBag
is unordered, elements are not accessed in any particular
order. If an item was inserted
N
times into the collection, then it will be visited
N
times.
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.
Public constructor
RWBagIterator(const RWBag&);
Construct an iterator for
RWBag
. After construction, the position of the iterator
is undefined.
Public member operator
virtual RWCollectable* operator()();
Redefined from class
RWIterator
. Advances the iterator to the next line item
and returns it. Returns nil when the end of the collection has been reached.