Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
What is the best small 2-dim QT container?
Raffael last edited by
I was wondering what would be the smallest and fastest 2-dimensional QT container?
I'm looking for something that will hold arrays of 60x60 up to 200x200 elements.
The values stored in the array would be 0,1,2 or I could split one big array to two same size arrays holding 0 and 1.
I've thought about using QVector< QVector<short> > or two QBitArrays.
The problem with
@QVector< QVector<short> >@
is that I don't know how to set it's size as normally it would go like
Next problem is how to access elements. First thing that comes to my mind is:
As for the QBitArray I couldn't find any way to make it 2 dimensional.
All I need is reading/writing and maybe filling whole array.
Thank You for all responses.
p-himik last edited by
You can use this:
typedef QVector< short > SubContainer;
const int size = 100;
QVector< SubContainer > vv( size, SubContainer( size ) ); @
As you said you can access elements with
@vv.at( x ).at( y )@
@vv[ x ][ y ]@