I realize this question may be impossible, but I'm pretty confused so I'm drawing at straws.
I'm trying to use a class from a big library. If I do this:
TheClass imageIterator(image, region);
everything works fine. However, if I do this:
TheClass imageIterator;
imageIterator = TheClass(image, region);
I get a segfault. The two constructors look like this:
TheClass::TheClass()
{
m_NumberOfPixelsInRegion = 0L;
m_NumberOfSamplesRequested = 0L;
m_NumberOfSamplesDone = 0L;
m_Permutation = NULL;
}
TheClass::TheClass(const ImageType *ptr, const RegionType & region):Parent(ptr, region)
{
m_NumberOfPixelsInRegion = region.GetNumberOfPixels();
m_NumberOfSamplesRequested = 0L;
m_NumberOfSamplesDone = 0L;
m_Permutation = new RandomPermutation(m_NumberOfPixelsInRegion);
}
It seems to me like calling the default constructor before the second shouldn't change anything, as everything is done in the default constructor is overridden by the second constructor.
From this tiny bit of information does anyone see an issue with doing this?
Thanks,
David