Changing size of a dynamically allocated matrix
- by user1309174
Trying to re-size the shape matrix dynamically. This is part of a drawing program where _capacity is the number of shapes drawn on a frame.
Get the error in new Shape about _capacity saying expression needs to have a constant value.
void ShapeStore::Grow(int minimumCapacity)
{
_capacity = max (minimumCapacity, 2 * _capacity);
if (_capacity)
{
Shape ***newData = new Shape[_frames][_capacity]; //figure out this
int i;
for (int k = 0; k < _frames; k++)
for (i=0;i<_count;i++)
newData[k][i] = _data[k][i];
delete [] _data;
_data = newData;
} //*/
}