No QMap is not a hash table.
Per the documentation:
The QMap class is a template class that provides a red-black-tree-based dictionary.
In other words it is a binary sort tree that uses the red-black tree algorithm to maintain balance. Meaning that searches will take O(logN) rather than O(1) as in the case of QHash.
It also means that QMap will keep the data sorted.
From the documentation you quoted:
QMap and QHash provide very similar functionality. The differences
are:
- QHash provides average faster lookups than QMap. (See Algorithmic
Complexity for details.)
- When iterating over a QHash, the items are arbitrarily ordered. With QMap, the items are always sorted by key.
- The key type of a QHash must provide operator==() and a global
qHash(Key) function. The key type of a QMap must provide operator<()
specifying a total order. Since Qt 5.8.1 it is also safe to use a
pointer type as key, even if the underlying operator<() does not
provide a total order.
QHash is a hash table. QMap is a binary sort tree using the red black tree algorithm.