[Insight-developers] Explicit instantiation
Gaetan Lehmann
gaetan.lehmann at jouy.inra.fr
Fri Apr 21 10:03:28 EDT 2006
I'm not sure to understand what the explicit instantiation does.
It build some template specialization for a restricted set of template
arguments, and put this code in the ITKCommon lib ?
What is the benefit ? Compilation time ? executable size ?
On Fri, 21 Apr 2006 15:46:06 +0200, Brad King <brad.king at kitware.com>
wrote:
> Miller, James V (GE, Research) wrote:
>> We've noticed code being checked into ITK to support explicit
>> instantiation.
>> Can someone put a page on the ITK proposals wiki page that details the
>> proposed methodology?
>
> Sure. I was planning to do this next week.
>
>> It looks like there are a collection of macros and nested include files
>> to indicate what needs to be instantiated.
>> Looking at the macros being introduced, I fear that our developers
>> will not know how to write the necessary macro for a new class they are
>> introducing. Do we need to use macros at all? Is it possible to just
>> type out the instantiations we want? I assume the macros are meant to
>> simply the export/import syntax.
>
> Users need only write one macro per template for which explicit
> instantiations are to be used. I plan to include extensive examples in
> the documentation to help users write them. The macros are necessary
> for making sure that everything exported is imported properly, and to do
> imports in a cross-platform way.
>
>> There seems to be a lot of files. Very nested. I fear it will be hard
>> for people to navigate.
>
> There is simply one .cxx and one .h per instantiation. This is just as
> if each instantiation were its own class, which from the compiler's
> point of view is the case.
>
> There is also one extra .h file per template, but its purpose is
> actually to simplify the code. We could just have itkImage.h include
> all the Templates/itkImage*.h instantiation import headers, but I
> created the extra Templates/itkImage+-.h as an intermediate step so that
> we can switch to generating the instantiations later without modifying
> itkImage.h.
>
>> Also, it appears that we are using a one-file-per-instantiation model.
>> Is this the best approach? Or would it be better to lump a number of
>> related instantiations into one file (as long as it wouldn't get too
>> big to compile)?
>
> See Bill Hoffman's answer for this. This is the same reason VXL uses
> one-per-file.
>
> -Brad
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr
More information about the Insight-developers
mailing list