![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtCore More...
#include <qhash.h>
Public Types | |
typedef const_iterator::iterator_category | iterator_category |
typedef qptrdiff | difference_type |
typedef Key | value_type |
typedef const Key * | pointer |
typedef const Key & | reference |
Public Member Functions | |
key_iterator () noexcept=default | |
key_iterator (const_iterator o) noexcept | |
const Key & | operator* () const noexcept |
Returns the current item's key. | |
const Key * | operator-> () const noexcept |
Returns a pointer to the current item's key. | |
bool | operator== (key_iterator o) const noexcept |
Returns true if other points to the same item as this iterator; otherwise returns false . | |
bool | operator!= (key_iterator o) const noexcept |
Returns true if other points to a different item than this iterator; otherwise returns false . | |
key_iterator & | operator++ () noexcept |
The prefix ++ operator ( {++i}) advances the iterator to the next item in the hash and returns an iterator to the new current item. | |
key_iterator | operator++ (int) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The postfix ++ operator ( {i++}) advances the iterator to the next item in the hash and returns an iterator to the previous item. | |
const_iterator | base () const noexcept |
Returns the underlying const_iterator this key_iterator is based on. | |
\inmodule QtCore
The QHash::key_iterator class provides an STL-style const iterator for QHash keys.
QHash::key_iterator is essentially the same as QHash::const_iterator with the difference that operator*() and operator->() return a key instead of a value.
For most uses QHash::iterator and QHash::const_iterator should be used, you can easily access the key by calling QHash::iterator::key():
However, to have interoperability between QHash's keys and STL-style algorithms we need an iterator that dereferences to a key instead of a value. With QHash::key_iterator we can apply an algorithm to a range of keys without having to call QHash::keys(), which is inefficient as it costs one QHash iteration and memory allocation to create a temporary QList.
QHash::key_iterator is const, it's not possible to modify the key.
The default QHash::key_iterator constructor creates an uninitialized iterator. You must initialize it using a QHash function like QHash::keyBegin() or QHash::keyEnd().
typedef const_iterator::iterator_category QHash< Key, T >::key_iterator::iterator_category |
|
inlineexplicitnoexcept |
|
inlinenoexcept |
Returns the underlying const_iterator this key_iterator is based on.
|
inlinenoexcept |
Returns true
if other points to a different item than this iterator; otherwise returns false
.
|
inlinenoexcept |
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 function on QHash::keyEnd() leads to undefined results.
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The postfix ++ operator ({i++}) advances the iterator to the next item in the hash and returns an iterator to the previous item.
|
inlinenoexcept |
Returns true
if other points to the same item as this iterator; otherwise returns false
.