[Interest] initialising a dictionary-type container instance with a static table?

René J. V. Bertin rjvbertin at gmail.com
Mon Jan 2 15:27:38 CET 2017


Konstantin Shegunov wrote:

> (a static array should serve you perfectly fine).

Yes, true. Presuming the enum values assigned by the compiler and thus 0-based 
and incremented by 1.

> It would mean the binary tree to be degenerate, and
> ultimately you'd get a rebalancing with each insert.

I didn't read the algorithmic complexity section and wasn't encumbered with a 
particular amount of relevant background on the container classes either. Thus, 
the claim that "With QMap, the items are always sorted by key" made it seem 
somewhat more appropriate for a case where you get the keys in sorted order 
simply by copy/paste. 

R.




More information about the Interest mailing list