I have a two-dimensional array of objects (a 2D vector containing GridCell instances), like here:
typedef vector<GridCell> CellArray;
typedef vector<CellArray> TwoDCellArray;
TwoDCellArray CellArr2D;
I am currently drawing all cells as follows:
for (int i = 0; i < rows; i++){
for (int j = 0; j < cols; j++){
CellArr2D[i][j].draw()
}
}
However, I have a problem with depth, and I have to draw instances depending on its size (size property, CellArr2D [i] [j] .size).
What should I do to sort this array without changing its i, j values? Copying all objects to a secondary array and sorting this? And more importantly, therefore, this post ... how can I sort an array (vector) using this object property?
Thanks in advance.
source
share