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.