template static member instantiation

Gabriel Dos Reis gdr@integrable-solutions.net
Fri May 28 14:00:00 GMT 2004


mec.gnu@mindspring.com (Michael Elizabeth Chastain) writes:

[...]

| Looking at Stroustroup, C++PL, 3rd edition, section C.13.1 says: "Static
| members must be separately defined and can be specialized." Section
| C.13.10 says: "When a class template is explicitly instantiated, every
| member function is also instantiated".  That kind of implies that the
| test program needs an explicit instantiation for each my_static.  But
| I'd like to get an expert opinion.

14.7.2/7

  The explicit instantiation of a class template specialization
  implies the instantiation of all of its members not previously
  explicitly specialized in the translation unit containing the
  explicit instantiation. 

That includes static data members too.

-- Gaby



More information about the Gcc mailing list