template<typename Key, typename Val, typename Hash, typename KeyEqual>
class QMultiHash< Key, Val, Hash, KeyEqual >::const_iterator
The QMultiHash::const_iterator class provides an STL style const iterator for QMultiHash. QMultiHash features both STL style iterators and Java style iterators.
QMultiHash::const_iterator allows you to iterate over a QMultiHash. If you want to modify the QMultiHash as you iterate over it use QMultiHash::iterator instead.
After construction you must initialize the iterator using a method like QMultiHash::constBegin(), QMultiHash::constEnd(), or QMultiHash::find() before you can start iterating. The following is an example which prints all of the (key, value) pairs in the container.
cout << iter.key() <<
": " << iter.
value() << endl;
}
Unlike QMultiMap which orders its items by key, QMultiHash stores its items in an arbitrary order. The only guarantee is items which share the same key will appear consecutively.
- See also
- QMultiHash::iterator
template<typename Key , typename Val , typename Hash , typename KeyEqual >
const_iterator QMultiHash< Key, Val, Hash, KeyEqual >::const_iterator::operator+ |
( |
size_type |
n | ) |
const |
|
inline |
Returns an iterator to the item at n positions forward from this iterator. If n is negative the iterator goes backward.
This operation can be slow for large values of n.
- See also
- operator-()
template<typename Key , typename Val , typename Hash , typename KeyEqual >
const_iterator & QMultiHash< Key, Val, Hash, KeyEqual >::const_iterator::operator++ |
( |
| ) |
|
|
inline |
The prefix ++ operator (++i
) advances the iterator to the next item in the hash and returns an iterator to the new current item.
Calling this method on QMultiHash::end() leads to undefined behavior.
template<typename Key , typename Val , typename Hash , typename KeyEqual >
const_iterator QMultiHash< Key, Val, Hash, KeyEqual >::const_iterator::operator- |
( |
size_type |
n | ) |
const |
|
inline |
Returns an iterator to the item at n positions backward from this iterator. If n is negative the iterator goes forward.
This operation can be slow for large values of n.
- See also
- operator+()