[Interest] QMultiHash / QMultiMap: insert QList?

Schimkowitsch Robert Robert.Schimkowitsch at andritz.com
Thu Oct 8 09:24:52 CEST 2026


Hi there,

I saw this data structure:

QHash<SomeKey, QList<SomeValue>>

…and I was wondering: Why not use QMultiHash?
The rationale was that it’s easier to extract and re-insert whole blocks (i.e. all values sharing the same key), which is indeed a relevant use case for the surrounding code.

There IS QHash::values(key) -> QList<value>, but what’s missing is the opposite function: insert(key, QList<value>)

Any special reason for this omission? Did I overlook a direct way to insert a QList of multiple values with the same key with a single operation, that is (almost) as efficient as adding a whole new list to the QHash?

Thanks!

Robert
________________________________

This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.

ANDRITZ HYDRO GmbH


Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation

Firmensitz/ Registered seat: Wien

Firmenbuchgericht/ Court of registry: Handelsgericht Wien

Firmenbuchnummer/ Company registration: FN 61833 g

DVR: 0605077

UID-Nr.: ATU14756806


Thank You
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20261008/cb3946ab/attachment.htm>


More information about the Interest mailing list