Module: Essential Tools Module Group: RWCollectable Classes
RWBinaryTreeIteratorRWIterator
// Smalltalk typedef: typedef RWBinaryTreeIterator SortedCollectionIterator; #include <rw/bintree.h> RWBinaryTree bt; RWBinaryTreeIterator iterate(bt);
Iterator for class RWBinaryTree. Traverses the tree from the "smallest" to "largest" element, where "smallest" and "largest" are defined by the virtual function compareTo(). Note that this approach is generally less efficient than using the member function RWBinaryTree::apply().
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.
Once the iterator has advanced beyond the end of the collection it is no longer valid -- continuing to use it will bring undefined results.
None
RWBinaryTreeIterator(const RWBinaryTree&);
Constructs an iterator for an RWBinaryTree. Immediately after construction, the position of the iterator is undefined until positioned.
virtual ~RWBinaryTreeIterator();
Empty destructor.
virtual RWCollectable* operator()();
Redefined from class RWIterator. Advances iterator to the next "largest" element and returns a pointer to it. Returns rwnil when the end of the collection is reached.
virtual RWCollectable* findNext(const RWCollectable* target);
Redefined from class RWIterator. Moves iterator to the next item which compares equal to the object pointed to by target and returns it. If no item is found, returns nil and the position of the iterator will be undefined.
virtual void reset();
Redefined from class RWIterator. Resets iterator to its state at construction.
virtual RWCollectable* key() const;
Redefined from class RWIterator. Returns the item at the current iterator position.
© 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.