19 May
2005
19 May
'05
12:32 a.m.
I need help with this one, even though it's a pure C++ question, it's about template optimization: If a template class has methods that DO NOT depend on or use the type parameter(s) of the template will the code for the methods nevertheless get instantiated separately for each unique instance of the template class? For example, if there are 20 unique types used to declare 20 instances of template class X, do those methods get implemented 20 different times, needlessly, and cause a big code bloat? Even if most compilers are smart about this kind of thing, is it still better practice to separate from the template class (or method) all of the code that does not use the template type parameters? Thanks, Elisha Berns e.berns@computer.org