Code Blot due to templates
1. [Multiple instantiations] Temp
translation unit, so when the objs are linked together, the exe has
more than one copy of Temp
2. [Duplicate instantiations] Temp
single underlying binary implementation, but they don’t. The most
common example is when T1 and T2 are both pointer types, but it would
also apply if T1=int and T2=long on a machine where int and long are
the same size.
3. [Near-duplicate instantiations] Temp
individually instantiated for non-type parameters n and m, even
though the resulting member functions are almost identical. This
would be the case for e.g., FixedSizeBuffer
FixedSizeBuffer
4. [Excessive inlining] Because many compilers require that all template
code be in header files, all such code is inlined, and that makes
executables bigger than they would be if template functions that are
large and frequently called could be outlined.
5. [Excessive instantiation] All the member functions of Temp
instantiated, even though only a few are called. (This is
nonstandard behavior, but, at least in the past, it was a problem
with some compilers.)
6. [Gratuitous types] Temp
if templates didn’t exist, programmers would make do with a single
untemplatized implementation. For example, programmers instantiate
both Stack
get by with only IntStack.