This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [bug] Template friends, namespace and instantiation


On Dec  9, 1998, Lavoie Philippe <lavoie@zeus.genie.uottawa.ca> wrote:

> Alexandre Oliva writes:
>> 
>> The actual problem is that you refer to the non-specialized version
>> within the declaration of class Vector, and only declare the
>> specialization after that.  The explicit instantiation is correct, but 
>> it will not affect the other translation unit unless it is at least
>> declared in the header file.
>> 

> You mean with something like

> extern template void resizeG(Vector<Point<float,3> >& , int );

> is that what you mean by having the explicit instantiation in the
> header? 

Nope, you must declare the specialization in the header file, before
you refer to it:

  template <> void resizeG(Vector<Point<float,3> >& , int );

This must be before the definition of Vector.

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]