[Insight-developers] IRIX64-6.5-CC-n32-Continuous errors and CastImageFilter

Luis Ibanez luis . ibanez at kitware . com
Tue, 06 Aug 2002 11:04:50 -0400


Aljaz Noe wrote:
> 
> Can you explain this? I know that pretty much everything in the FEM
> library is polymorphic. And AFAIK it worked quite well with
> SmartPointers using a &* hack.
> 

Sure, the &* hack will still work...

The "*" is extracting the Reference to the object from the
SmartPointer and the "&" is getting the Raw pointer to the
object. We can still do this "&*" notation with SmartPointers
but the GetPointer() method of the smartpointer seems to be a
much clearer approach.

And probably this notation

     filter.SetImage( & * mySmartPointer );

will produce a lot more questions from the users
than this one

     filter.SetImage( mySmartPointer.GetPointer() );

--
> 
> So... Should we change the FEM library from T::Pointer back to T*? The
> only benefit in doing this IMHO is that we could use one or two forward
> class declarations instead of #include's.
> 

In the interest of performance it seems to be a good idea to replace
the instances of T::Pointer by T *. In particular if assignments are
a common operation in the FEM code.

Among Ivars, it is a matter of knowing if the object in question is
likely to be destroyed while is still in use. In that case, the
SmartPointer is still the way to go.

Unless these changes help you to solve some of the current
difficulties with instantiations, this doesn't seems to be a high
priority at this point.


   Luis