Solved Why is qhash not in insertion order?
-
hello,Why is qhash not in insertion order?
-
Hi
Its pr design. For speed. ( insert can be faster )
If you need it ordered, use QMap. -
@canid
Why should it be? Normal hashing algorithms won't help you at all with insertion order (the order you insert keys into it).(BTW, you're not talking about hash key clashes are you?? Or multi-values with same key?)
@mrjj
I don't see thatQMap
would have anything to do with insertion order. (Unless you mean if the input data is ordered in the first place, but the question doesn't imply that.) -
@mrjj
hello,It seems that qmap can only be sorted by keys, not by insertion order -
@canid
What is it you actually want? A hash table, so that you can very quickly look up by key? But you also want it to be ordered as per the insertions you made?? -
@canid
ah. yes sorry. my bad.
Read too hasty.
Map type containers rarely keep insertion order unless made to do so.
https://github.com/Tessil/ordered-map