QMultiMap is intended to store key-value pairs for fast lookup by key where a key can have multiple values.
The QList QMap::keys(const T &value) const method which is inherited from QMap, will return a QList of keys for a specific value. That won't be fast lookup and the time complexity would be linear.
QMultiMap is intended to store key-value pairs for fast lookup by key where a key can have multiple values. The QList QMap::keys(const T &value) const method which is inherited from QMap, will return a QList of keys for a specific value. That won't be fast lookup and the time complexity would be linear.
Which
ks
will contain [1,2].