PDA

View Full Version : Storing and managing huge arrays



maka
22nd July 2009, 07:27
Hello, people!

I'm starting with QT. My current aim is to store huge arrays of
seven different types. I don't not know which type exactly do I need,
it depends of file type that i'm going to read.
My idea is to write a class that has seven QVarLengthArrays. Six of
them are allways null and one stores my data. But this decision looks
quite gracelessly... So my questions are:

0. Is there any more elegant way to store my data?

1. Is QVarLengthArray sizable for this kind of job? (Storing huge(1
000 000 elements) arrays)


Thanks all of you for your time and attention!

wysota
22nd July 2009, 08:49
I'd use a QVector of QVariant and register your objects with QVariant using Q_DECLARE_METATYPE. This way you can use always the same code for managing your array.

maka
22nd July 2009, 09:35
I'd use a QVector of QVariant and register your objects with QVariant using Q_DECLARE_METATYPE. This way you can use always the same code for managing your array.

Thank you!
I have to read some docs and make some experiments... But before this may I ask you one more question? I have to process my data and its size could be changed. I need also fast access to data due to necessity of this processing.
Will QVector work well?

spirit
22nd July 2009, 09:37
read this (http://doc.trolltech.com/qq/qq19-containers.html) article. it should answer on your question.