The maximum size of a QList
Hello,
I've got a question,
What is the maximum size of a QList?
Is it of type integer? Because the iterators and access features are all integer based.
If so, What is the maximum size of the list? (Which integer type is actually used?)
Is it system dependent or (int32, int64 etc.) or is it a defined integer?
If I try to put in more objects than the maximum size of the QList?
What happens then?
I've read the Qt Reference but it doesn't say what will happen in these instances.
Re: The maximum size of a QList
Quote:
Originally Posted by
Denarius
What is the maximum size of a QList?
It's limited only by the memory.
Quote:
Is it of type integer?
What is the return type of QList::count()?
Quote:
Because the iterators and access features are all integer based.
Then you have your answer.
Quote:
If so, What is the maximum size of the list? (Which integer type is actually used?)
Is it system dependent or (int32, int64 etc.) or is it a defined integer?
If it says "int" then this means "int" which is a C type that can differ between architectures, if it says "int32" then it means "32 bit signed integer value" which mean 2^31.
Quote:
If I try to put in more objects than the maximum size of the QList?
What happens then?
You will most likely kill your application or render it useless. I can't imagine a usecase where you'd need 2G different values and you would store them in a linear list. Traversing such a list would take ages.
Re: The maximum size of a QList
hi,
a short note:
i encountered a problem using QList<QString> var; for a list with filenames.
at an amount of 20000 files the processing slowed downed this much, that it seems to be a delay function "sleeping" for milliseconds.
maybe this is also part of the discussion about "how much entries could a QList object have?" ...
//SiL
Re: The maximum size of a QList
Quote:
Originally Posted by
SiL3NC3
hi,
a short note:
i encountered a problem using QList<QString> var; for a list with filenames.
at an amount of 20000 files the processing slowed downed this much, that it seems to be a delay function "sleeping" for milliseconds.
maybe this is also part of the discussion about "how much entries could a QList object have?" ...
//SiL
That's quite a small list. I have used larger ones many times without issues. It is about how you use a list, that decides whether it is "slow" or "fast". If you want to iterate over 20000 items then regardless if it is going to be QList or some other data structure, it is going to take time.