gcc problem with explicit template instantiation?

Posted by steve jaffe on Stack Overflow See other posts from Stack Overflow or by steve jaffe
Published on 2010-04-29T15:53:52Z Indexed on 2010/04/29 16:17 UTC
Read the original article Hit count: 301

Filed under:
|
|

It is my understanding that either a declaration or typedef of a specialization ought to cause a template class to be instantiated, but this does not appear to be happening with gcc. E.g. I have a template class, template class Foo {};

I write

  class Foo<double>;  

or

typedef Foo<double> DoubleFoo;  

but after compilation the symbol table of the resulting object file does not contain the members of Foo.

If I create an instance:

Foo<double> aFoo;  

then of course the symbols are all generated.

Has anyone else experienced this and/or have an explanation?

© Stack Overflow or respective owner

Related posts about c++

Related posts about templates