[Bug c++/19569] no code for explicit instantiation of template class specialization

jamesp at trdlnk dot com gcc-bugzilla@gcc.gnu.org
Mon Jan 24 14:03:00 GMT 2005


------- Additional Comments From jamesp at trdlnk dot com  2005-01-24 14:03 -------
According to paragraph 7 of section 14.7.2 in the C++ standard, this is supposed
to work as I described.

I admit that the sample code I supplied doesn't show why this functionality is
necessary, so I'll try to explain my motivation. I'm writing a library that
defines a template class that is supposed to be specialized by client code.
There is no default implementation for the template class member functions. I
consider the implementation of the template class a detail related to this
library and don't want to force the client to litter header files with these
details. The header files for the library contain enough of the details to
generate the necessary function calls properly without forcing the user to
define the specialized template class member functions in a special location. My
recommendation to the users is to define the specialization in a .cc file,
explicitly extantiate the class, and link in the code as necessary rather than
create special header files. In short, it's just a lot cleaner and easier for
the clients to maintain.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19569



More information about the Gcc-bugs mailing list