Search code examples
c++qtdata-structuresqmap

QMap but without sorting by key


I need structure like QMap but without sorting on keys, so if I insert item there first I can count that this item will be before all others. And insert pair before or after specified element. Does Qt have such?


Solution

  • QMap is implemented as a tree, which means that the insertion order does not matter. It appears that you are looking for a queue. However, if you need a container which can be iterated in both insertion order and at the same time accessed through a specific key, then Qt has no such structure for you.

    These could help you: