M
mundacho
hello,
I'd like to know if this code is going to create a memory leak in the
calling function:
ili::IntImg
&RectangleImageComparator::synchronize(const ili::IntImg &pImage)
{
ili::IntImg *tempObj = new ili::IntImg(pImage);
return *tempObj;
}
i wanted to return a reference because it's faster because the object
is not copied but passed directly, isn't it?. My question is if the
calling function will free automatically the object returned, if I
do:
// in the calling function I'd do:
ili::IntImg myVar = synchronize(image); // will myVar be destroyed
automatically???
Thanks in advance,
eD
I'd like to know if this code is going to create a memory leak in the
calling function:
ili::IntImg
&RectangleImageComparator::synchronize(const ili::IntImg &pImage)
{
ili::IntImg *tempObj = new ili::IntImg(pImage);
return *tempObj;
}
i wanted to return a reference because it's faster because the object
is not copied but passed directly, isn't it?. My question is if the
calling function will free automatically the object returned, if I
do:
// in the calling function I'd do:
ili::IntImg myVar = synchronize(image); // will myVar be destroyed
automatically???
Thanks in advance,
eD