Boost logo

Boost Users :

From: Elisha Berns (e.berns_at_[hidden])
Date: 2005-05-18 19:32:49

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?


Elisha Berns

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at