-
template
class
PortableHashtableIterator<class KeyType, class ValueType>
(Return to index)
-
This class is an iterator object, used for iterating over the set
of keys or values in a PortableHashtable.
Type:
Include file:
../../hashtable/PortableHashtable.h
Note that it is illegal
to modify the hashtable during an iteration traversal (an assertion
failure will occur if you try it, and your program will exit)
Given a PortableHashtable object, you can obtain one or more of these
iterator objects by calling the PortableHashtable's GetIterator() method.
This iterator actually contains separate state for two iterations:
one for iterating over the values in the PortableHashtable, and one for
iterating over the keys. These two iterations can be done independently
of each other.
Synopsis:
Public methods:
- public bool
GetNextKey (KeyType & setNextKey)
If there are more keys left in the key traversal, copies the next one into
(setNextKey) and returns true. Otherwise, returns false.
- public bool
GetNextValue (ValueType & setNextValue)
If there are more values left in the values traversal, copies the next one into
(setNextValue) and returns true. Otherwise, returns false.
- public bool
HasMoreKeys () const
Returns true iff there are more keys left in the key traversal.
- public bool
HasMoreValues () const
Returns true iff there are more values left in the value traversal.
- public bool
PeekNextKey (KeyType & setKey) const
Copies the next key in the key traversal into (setKey) without modifying
the state of the traversal. Returns false iff there are no more keys left.
- public bool
PeekNextValue (ValueType & setKey) const
Copies the next value in the value traversal into (setValue) without modifying
the state of the traversal. Returns false iff there are no more value left.
Friend methods: