THanks for your answers.
A bit of info about what I need to implement. The size of the table
will be unknown until runtime.
But when it is known is it then constant?
The table will be fairly big (a few
thousands of cells) and will contain both numbers and text strings at
the same time. Numbers will have to remain as such in order to do
maths with them.
Once the table has been acquired, regrouping of cells will be done: 1
cell from every 2x2, with a content (text of number) calculated through
certain algorithms on the 4 grouped cells. Then further groupings: 1
cell with every 4x4, 8x8...). The original table needs to be preserved
and change of views will be done, forth and back, responding to user
actions, in real time.
Many thanks for any further comments on how to implement this
From C++ point of view this is basic stuff.
I don't know what types your cell contains (ie. is it an integer or floating point
number, and can the string be arbitrarily long or is there a max length),
but you have multiple ways to chose from. The simplest but maybe not
that mighty would be something like:
struct Cell
{
int iVal;
char szStr[64];
};
Cell* paCell = new Cell[nCells];
where nCells is the number of cells to allocate dynamically.
This is a 1-dimensional array of Cells; you can also make it n-dimensional.
Here you must delete the resource when finished by using
delete [] paCell;
On the other hand, depending on the class used, STL does the allocation
either in the constructor or when a new item gets added, and frees the
resource(s) in its destructor.
You just need to specify your application requirements as complete
as possible, but this is of course obvious for any language used.
I personally would recommend to use STL classes.