With much pleasure I've started using a TR1 imlpementation. I'm a bit wobbly
with it, but I'd dearly like to replace some code involving old-school
pointers with some shared_ptr
The original code is as follows below. It creates an array int* of size
rows, each of which points to an array of size cols - in essence, a 2D array
which I use for ease of coding when dealing with 2D images in this
particular instance.
I'm a bit stuck on how to rewrite this to use shared_ptr - I had a go but
got a bit lost. I'd be grateful if someone could show me how to replace
these pointers with some nice safe shared_ptr
'Chops
if (0 == this->overlayImage) // If memory not yet allocate for
overlayImage - pointer set to zero in constructor
{
int **a;
int rows=this->image_size.cy,cols=this->image_size.cx;
a=new int* [rows];
for(int i=0;i<rows;i++)
*(a+i)=new int[cols];
this->overlayImage = a;
}