I’ve been using nested ScopedPointers to implement a 2D array of doubles.
// 2D array first dimension ‘x’, second dimension 'y’
myArray = new ScopedPointer[x];
for (int i=0; i<x; i++)
myArray[i] = new double[h];
for (int j=0; j<y; j++)
myArray[i][j] = 0;
I now want to dynamically re-size the array. The only way I’ve successfully been able to achieve that is to call myArray.release() before re-initialising.
Now, the class documentation for ScopedPointer clearly states that release() doesn’t cause the object to be deleted - but if I call release() without assigning the result to a variable, does that mean the object disappears and the memory gets deallocated anyway?
Thanks in advance,