Module: Essential Tools Module Group: RWCollectable Classes
RWBagConstIterator RWConstIterator
#include <rw/rwbag.h> RWBag b; RWBagConstIterator it(b);
Provides an iterator for class RWBag that allows sequential access to all the elements of RWBag and that does not change any member of RWBag. Note that because an RWBag is unordered, elements are not accessed in any particular order. If an item was inserted N times into the collection, then it is visited N consecutive times.
Like all Rogue Wave iterators, the "current item" is undefined immediately after construction -- you must define it by using operator() or some other (valid) operation. This does not apply when using the begin() and end() methods of RWBag.
Once the iterator has advanced beyond the end of the collection it is no longer valid -- continuing to use it will cause undefined results.
None
RWBagConstIterator(const RWBag&);
Construct an iterator for an RWBag. After construction, the position of the iterator is undefined.
virtual const RWCollectable* operator()();
Redefined from class RWConstIterator. Advances the iterator to the next item and returns it. Returns nil when the end of the collection has been reached.
virtual const RWCollectable* findNext(const RWCollectable* target);
Redefined from class RWConstIterator. Moves iterator to the next item which isEqual to the object pointed to by target and returns it. Uses hashing to find the target. If no item is found, returns nil and the position of the iterator is undefined.
virtual const RWCollectable* key() const;
Redefined from class RWConstIterator. Returns the item at the current iterator position.
virtual void reset();
Redefined from class RWConstIterator. Resets the iterator to its starting state.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.