|
| HashConstIterator () |
| Creates a hash iterator pointing to no element.
|
|
| HashConstIterator (const HashConstIterator< K, I, H > &it) |
| Copy constructor.
|
|
| HashConstIterator (HashElement< K, I > *pElement, HashElement< K, I > **pList, const Hashing< K, I, H > *pHashing) |
| Creates a hash iterator pointing to element pElement in list pList of hash table pHashing .
|
|
const I & | info () const |
| Returns the information of the hash element pointed to.
|
|
const K & | key () const |
| Returns the key of the hash element pointed to.
|
|
HashConstIterator< K, I, H > & | operator++ () |
| Moves this hash iterator to the next element (iterator gets invalid if no more elements).
|
|
HashConstIterator & | operator= (const HashConstIterator< K, I, H > &it) |
| Assignment operator.
|
|
bool | valid () const |
| Returns true if the hash iterator points to an element.
|
|
template<
class K,
class I,
class H = DefHashFunc<K>>
class ogdf::HashConstIterator< K, I, H >
Iterators for hash tables.
This class implements an iterator for iterating over all elements in a hash table. Hash iterators are provided by Hashing<K,I>::begin().
Example
The following code snippet demonstrates how to iterate over all elements of a hash table. First, the example fills a hash table with a tiny German–English dictionary, and then it iterates over the elements and prints the entries.
H.fastInsert(
"Katze",
"cat");
H.fastInsert(
"Maus",
"mouse");
for(it =
H.begin(); it.
valid(); ++it)
std::cout << it.
key() <<
" -> " << it.
info() << std::endl;
Iterators for hash tables.
bool valid() const
Returns true if the hash iterator points to an element.
const K & key() const
Returns the key of the hash element pointed to.
const I & info() const
Returns the information of the hash element pointed to.
Hashing with chaining and table doubling.
HashElement< K, I > * fastInsert(const K &key, const I &info)
Inserts a new element with key key and information info into the hash table.
Definition at line 429 of file Hashing.h.