Tools.h++ Manual
104011 Tandem Computers Incorporated 22-99
22
RWTValHashTableIterator<T>
Synopsis
#include <rw/tvhasht.h>
RWTValHashTable<T> table;
RWTValHashTableIterator<T> iterator(table);
Description Iterator for class
RWTValHashTable<T>
, allowing sequential access to all the
elements of a hash table. 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
RWTValHashTableIterator(RWTValHashTable<T>& c);
Constructs an iterator to be used with the table
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
RWTValHashTable<T>* container() const;
Returns a pointer to the collection over which this iterator is iterating.
T key() const
Returns the value at the iterator's current position. The results are undefined if
the iterator is no longer valid.
void reset();
Resets the iterator to the state it had immediately after construction.
void reset(RWTValHashTable<T>& c);
Resets the iterator to iterate over the collection
c
.