[Insight-developers] ConstPointers
Mark Foskey
mark_foskey at unc . edu
Wed, 10 Dec 2003 12:46:40 -0500
There is what appears to be an inconsistency with SmartPointers and
const-ness. You can do:
ImageType* image = someFilter->GetOutput();
ImageType::Pointer imageSmart = image;
But you cannot do:
const ImageType* image = someFilter->GetOutput();
ImageType::ConstPointer imageSmart = image;
Or at least, I can't do it with MSVC 6.0. There is no operator=()
defined for that case.
I believe this has never come up because you rarely take a const image
as input since you might want to call its Update() method. Perhaps we
should explicitly point that out to people trying to write filters.
Is this inconsistency a problem that should be fixed?
--
Mark Foskey (919) 843-5436 Computer-Aided Diagnosis and Display Lab
mark_foskey at unc . edu Department of Radiology, CB 7515, UNC
http://www . cs . unc . edu/~foskey Chapel Hill, NC 27599-7515