View Single Post
Old May 31st, 2006, 2:25 AM   #5
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,253
Rep Power: 5 grumpy will become famous soon enough
Quote:
Originally Posted by manannan
Thank you, Dark and Grumpy. When I grow up, I'll weasel my way into the ISO C++ Standards Committee and make them abolish the restriction.
I wish you good hunting, but am prepared to bet you won't succeed. The reason for the restriction is to allow C++ implementations flexibility of how they implement template instantiation behind the scenes. Some implementations use template repositories, and the actual process of template instantiation happens at link time rather than at compile time (that means a smarter linker working with a slightly dumber compiler). The benefit of such schemes is reducing code bloat (eg multiple identical instantiations of a template within a single executable) by allowing the linker to instantiate each template specialisation only once. A side-effect of such schemes is that all template type parameters must have external linkage.

Last edited by grumpy; May 31st, 2006 at 2:35 AM.
grumpy is offline   Reply With Quote