robgeek
24th March 2015, 17:19
Hello!
I want to create a bidimensional array(int matrix[5][5]) using QT libraries but i don't know which "technique" to choose.
Which one do you think is more correct?
QList<QVector<int>> matrix;
//or
QVector<QVector<int>> matrix;
In my case, i cannot use "int matrix[5][5]" directly because i'll read the data from a file and put the data(numbers) in a bidimensional array. I could use directly, but i would have to read the file two times to do that. First, to discover how many line and columns he has, then i could create the array, like "int matrix[lines][cols]" and the second time to put the data in it. I think is better using QList/QVector.
Thanks!
I want to create a bidimensional array(int matrix[5][5]) using QT libraries but i don't know which "technique" to choose.
Which one do you think is more correct?
QList<QVector<int>> matrix;
//or
QVector<QVector<int>> matrix;
In my case, i cannot use "int matrix[5][5]" directly because i'll read the data from a file and put the data(numbers) in a bidimensional array. I could use directly, but i would have to read the file two times to do that. First, to discover how many line and columns he has, then i could create the array, like "int matrix[lines][cols]" and the second time to put the data in it. I think is better using QList/QVector.
Thanks!