Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWTValHashTableIterator<T>

Alternative interface: no Standard C++ Library

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <rw/tvhasht.h>
RWTValHashTable<T> table;
RWTValHashTableIterator<T> iterator(table);

Please Note!


If you do not have the Standard C++ Library, use the interface described here. Otherwise, use the interface to RWTValHashMultiSetIterator described in the Class Reference.


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 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.

Persistence

None

Example

#include<rw/tvhasht.h>
#include<iostream.h>
#include<rw/cstring.h>

int main(){
   RWTValHashTable<RWCString> age(RWCString::hash);
   RWTValHashTableIterator<RWCString> itr(age);
   age.insert("John");
   age.insert("Steve");
   age.insert("Mark");
   age.insert("Steve");
   for(;itr();)
     cout << itr.key() << endl;
   return 0;
}
Program Output (not necessarily in this order)
John
Steve
Mark
Steve

Public Constructor

RWTValHashTableIterator(RWTValHashTable<T>& c);

Public Operators

RWBoolean
operator++();
RWBoolean
operator()();

Public Member Functions

RWTValHashTable<T>*
container() const;
T
key() const;
void
reset();
void
reset(RWTValHashTable<T>& c);


Previous fileTop of documentContentsIndexNext file
Return to the main class reference
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.