Tools.h++ Manual

22-90 104011 Tandem Computers Incorporated
22
RWTValHashDictionaryIterator<K,V>
Synopsis
#include <rw/tvhdict.h>
unsigned hashFun(const K&);
RWTValHashDictionary<K,V> dictionary(hashFun);
RWTValHashDictonaryIterator<K,V> iterator(dictionary);
Description Iterator for class
RWTValHashDictionary<K,V>
, allowing sequential access
to all keys and values of a parameterized hash dictionary. Elements are not
accessed in any particular order.
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
RWTValHashDictionaryIterator(RWTValHashDictionary& c);
Constructs an iterator to be used with the dictionary
c
.
Public operators
RWBoolean operator++();
Advances the iterator one position. Returns
TRUE
if the new position is valid,
FALSE
otherwise.
RWBoolean operator()();
Advances the iterator one position. Returns
TRUE
if the new position is valid,
FALSE
otherwise.
Public member functions
RWTValHashDictionary* container() const;
Returns a pointer to the collection over which this iterator is iterating.
K key() const;
Returns the key at the iterator's current position. The results are undefined if
the iterator is no longer valid.