[Insight-developers] GCC4 needing template <>

Karthik Krishnan Karthik.Krishnan at kitware.com
Fri May 13 10:15:01 EDT 2005


I believe VS also needs template <> in cases of explicit specialization. 
Otherwise it will bark with things like:

*c:\Dashboards\My Tests\InsightContinuous\Code\Common\itkNumericTraitsTensorPixel.h(12) : error C2906: 'itk::NumericTraits<itk::SymmetricSecondRankTensor<TComponent,NDimension>>' : explicit specialization requires 'template <>'*



Kent Williams wrote:

> Gcc4 it requires 'template <>' before the explicit specialization of 
> templated functions. This came up in discussions a couple weeks ago 
> when I started looking at GCC4, and someone suggested that this not be 
> used universally, but added in (via #ifdefs) on platforms/compilers 
> that required it.
>
> But, in looking through the ITK headers it seems like 'template <>' is 
> used unconditionally. So I'm guessing it needs to be added to the 
> macros in itkMetaDataObject.h like NATIVE_TYPE_METADATAPRINT. Or 
> should maybe those macros go away? The only place they actually get 
> used as near as I can tell is in one program -- one of ours, not part 
> of ITK -- where they probably aren't necessary.
>
> The other new complaint of GCC4 -- at least with the compiler flags we 
> use -- is 'warning: ‘class itk::Region’ has virtual functions but 
> non-virtual destructor' -- which is actually triggered by several ITK 
> classes. Should those classes define a virtual destructor? In the case 
> of itk::Region there is no destructor, because it's a virtual base 
> class, from which itk::ImageRegion and itk::MeshRegion derive.
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20050513/b6616214/attachment.htm


More information about the Insight-developers mailing list