[Insight-developers] Re: itkStaticConstMacro and Explicit Instantiation

Brad King brad.king at kitware.com
Tue, 27 Apr 2004 12:16:03 -0400


Miller, James V (Research) wrote:
> Brad, 
> 
> I had to put an explicit instantiation of ParametricPath into the ITKCommon
> dll a ways back. ParametricPath is a templated class that has non-templated
> subclasses.  itkParametricPath ended up with a .h, a .txx and a .cxx file.
> 
> Would this work in place of "extern template"?

The use of "extern template" allows certain common instantiations to be 
explicitly instantiated in one place while still allowing less common 
instantiations to be created implicitly.  In order to work without the 
"extern template" extension, we would have to take the full vxl approach 
  of explicit instantiation without ever including the .txx in user 
code.  This will definately not be backward compatible and will require 
more programming knowledge from the users.

> Otherwise, the StaticConstMacro is defined as unsigned int everywhere it
> can because that was supposed to be the "accepted" practice.  At the time
> we might have thought this would also help us support the compilers on 
> Solaris but I am not sure whether we have recently is checked whether the 
> Solaris compilers have caught up to ITK.

I suppose I should make the change to enum locally in my working copy in 
order to experiment with the compile time improvements of using extern 
template.  Then we can make the change to ITK only if there is a 
substantial improvement.

-Brad