[Insight-users] Does itkSmartPointer.h need to do #include "itkMacro.h"?

Niels Dekker niels-xtk at xs4all.nl
Thu May 15 06:53:22 EDT 2008


itkSmartPointer.h has an #include "itkMacro.h", which indirectly 
includes a lot of other header files. As far as I can see, 
itk::SmartPointer only uses one macro, ITK_EXPORT, as follows:

  template <class TObjectType>
  class ITK_EXPORT SmartPointer

ITK_EXPORT is defined in "itkWin32Header.h", as follows:

  // ITK_EXPORT can not be used
  #define ITK_EXPORT

So instead of #include "itkMacro.h", shouldn't itkSmartPointer.h do 
#include "itkWin32Header.h"?

What about just removing ITK_EXPORT from itk::SmartPointer? If that 
would be okay, the #include could simply be removed.

FYI, I was trying to fix the copy constructor of itk::ExceptionObject, 
by having the exception data managed by an itk::SmartPointer, but I 
couldn't get it to work because of that particular #include.  See also 
"Suggestions for itk::ExceptionObject", 
http://www.itk.org/pipermail/insight-users/2007-July/023056.html

Kind regards,

  Niels

--
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center 



More information about the Insight-users mailing list