Arrays & Vectors Dimensions
Hi everybody,
I have the following problem: My program is mathematical, so I need to use objects like
Code:
#define N 1000.....
.. double a[N]; double b[N][N]; ...
Now, my big problem is the N, if it's too big > 10000 on Windows (with VC++) it gives me application error (runtime error, as I understand the compiler cannot optimise the memory), so I need to use very small vectors/arrays.
My question is: Is there a Qt class that creates a vector like my example, and manage the memory of the PC to obtain an "indefinite" dimension vector/array?
Thank you very much for any kind of help.
Re: Arrays & Vectors Dimensions
well, i cant definitelys say if it'll solve ur problem..but check out QVector
Re: Arrays & Vectors Dimensions
Thank you to the fast reply,
QVector is a good solution I think, but do you know if we can use it as:
Code:
QVector<double> a(5)(3); //???
If no, what I can use to create: double a[][] ? (i.e. QMatrix?)
Re: Arrays & Vectors Dimensions
Quote:
Originally Posted by
lixo1
Thank you to the fast reply,
QVector is a good solution I think, but do you know if we can use it as:
Code:
QVector<double> a(5)(3); //???
If no, what I can use to create: double a[][] ? (i.e. QMatrix?)
use QVector of QVector, such as QVector<QVector<double>> array;
remember resize array before you use it.
Re: Arrays & Vectors Dimensions
no, QMatrix is entirely for different purpose and i dont think u can write
Code:
QVector<double> a(5)(3);
but most of the time, QT's container classes are so helpful that u wont need double-dimension array..here is a list of QT's container class and how they r implemented..u'll find it useful and hopefully it'll solve ur problem
http://doc.trolltech.com/4.4/containers.html
Re: Arrays & Vectors Dimensions
Hi,
Thank you very much for all information and help, now it's clear!