[Insight-users] export template in VXL classes

Eric Nodwell enodwell at ucalgary.ca
Wed May 12 17:03:20 EDT 2010


Hi,

Does anyone know if the export template declarations in the VXL classes actually do anything?  For example, in vnl_matrix.h there is the following line:

   export template <class T> class vnl_matrix;

This is a bit puzzling, because as far as I know:

1. "export templates" is not supported by any commonly used compiler.  (In fact, why does this line not generate a compile error for most compilers?  Do they just ignore export template statements?)

2. vnl_matrix.txx provides a large number of common explicit instantiations in any case and it seems that in practice you have to provide your own explicit instantiations if you want some odd-ball type, with VXL providing a macro for this purpose (see http://public.kitware.com/vxl/doc/release/books/core/book_17.html#SEC194).

3. "export" is deprecated until some indeterminate future date when the C++ standards committee can figure out the best way to separate template definitions and implementations.  See http://en.wikipedia.org/wiki/C%2B%2B#Exported_templates .

This is obviously not a burning issue, but I'm curious if this line has any actual function, or if it's a relic from the past, or if it's a hopeful anticipation of the future.

Eric



More information about the Insight-users mailing list