[Qt-interest] QList vs QVector

Martin Hofius Martin at hofius-online.com
Wed Jul 29 15:18:20 CEST 2009


Hi,

Am Mittwoch, 29. Juli 2009 schrieb Ankit Agarwal:
> Hi,
> I have a large set of data, say 5,00,000. There are objects of user defined
> class. I need to create a list. Assuming that I do not need to  edit the
> list very often, which is recommended out of the following two - QList and
> QVector. I shall be traversing the list many times.

I think, that the description in
http://doc.trolltech.com/4.5/containers.html#algorithmic-complexity

might answer your question. 
In general you have to think about the following criteria:

- do you have to garant constant effort to insert data sets in the middle of 
your array?
- do you want top sort your array sometimes?
- do you need random access to single elements of your data or do you read 
blocks of adjacent data?

Greetings
Martin



More information about the Qt-interest-old mailing list