[Insight-developers] SmartPointer comparison operators

Luis Ibanez luis.ibanez@kitware.com
Thu, 09 May 2002 12:32:24 -0400


Aljaz Noe wrote:

>>Constructing and assigning SmartPointers require a Mutex operation.
>>This can be expensive in computing time.
>>
>
>I know. I suspected this a long time ago. That's why the whole FEM library
>can be compiled either with the use of SP or not, by simply setting a flag
>in CMake. If you want speed, you don't use SP. On the other hand, if you
>need/want SP, you can still use them.
>
It seems that you were right on your suspicions...

We may take advantage of this oportunity to make things uniform. It is 
likely that
most of the potential uses of SmartPointers in FEM would have been removed
at this time anyways.

The only methods that need to return SmartPointers are those  constructing
objects and not holding pointer to the newly constructed object.

We could check this now and leave only the minimum number of required
SmartPointers. That will make unnecessary the CMake flag :

          FEM_USE_SMART_POINTERS

The FEM code seems to be evolving quite fast, we could coordinate a day
or two for doing these changes on FEM and avoid disturbing the code that
you are modifying right now.

The other directories : Common, BasicFilter, Algorithms, IO and Numerics
are almost ready and probably will be checked in this afternoon.

>
>
>The previously described problems only occurred when the SP were used.
>
Well, this last problem that you reported is an actual bug
Comparison operator must be "const"
(Unless somebody want to do quantum mechanics on itk objects  :-)  



  Luis