[Insight-users] export template in VXL classes
Luis Ibanez
luis.ibanez at kitware.com
Tue May 25 13:56:56 EDT 2010
Hi Eric,
Thanks for pointing this out.
It seems that you are right.
The "export" statements are simply ignored.
For example, a file "export.cxx" with code:
------------------------------------------------------------
export template <class T> class foo;
template <class T>
class foo
{
public:
};
------------------------------------------------------------
when compiled as
g++ -c export.cxx
produces:
export.cxx:1: warning: keyword ‘export’ not implemented, and will be ignored
with gcc version:
g++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1
---
Please note that ITK itself (Insgith/Code)
doesn't use "export" statements.
--
Just for the record, you may find interesting
this Wiki page
http://www.itk.org/Wiki/Proposals:Explicit_Instantiation
Regards,
Luis
------------------------------------------------------------
On Wed, May 12, 2010 at 5:03 PM, Eric Nodwell <enodwell at ucalgary.ca> wrote:
> 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
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list