Hi guys,
I've got a bidimensional array of objects (a 2D vector containing GridCell instances) as in here:
typedef vector<GridCell> CellArray;
typedef vector<CellArray> TwoDCellArray;
TwoDCellArray CellArr2D;
I am currently drawing all the cells like this:
for (int i = 0; i < rows; i++){
for (int j = 0; j < cols; j++){
CellArr2D[i][j].draw()
}
}
However, I've got a depth problem and I should draw the instances depending on its size (size property, CellArr2D[i][j].size).
What should I do to sort this array without changing it's i,j values? Copying all the objects to a secondary array and sort that one? And more imporntant, hence this post... how can I sort an Array (Vector) by it's contained object property?
Thanks in advanced.