[Qt-interest] Online sorted structure

Ian Thomson Ian.Thomson at iongeo.com
Tue Mar 24 18:11:20 CET 2009


Hi,

QSet and QMap's keys are enforced to always be unique, no duplicates. 
That might not be what you want.

You can make your own template class which has a QList inside it (or 
perhaps inherited from). Then you can write your own insert function(s) 
which ensure the list is always sorted, and wrap any other functions you 
want. A simple binary search should give you ln(n) time, and the memory 
overhead will match a QList.

Cheers,
Ian.




More information about the Qt-interest-old mailing list