* Andy:
I got a little confused on 'instantiation' and 'specialization',
espcially for explicit instantiation and explicit sepcialization. Can
anybody explain the difference?
You specialize a template when you provide a definition for some actual
template parameter, e.g., saying "in general, use the general definition,
but for template parameter T=int, use this more specialized definition".
This specialized definition may or may not be actually used, so
specialization by itself does not cause a more thorough analyzis than
the original template definition.
You instantiate a template when you cause the compiler to generate code for
the template. This requires all template parameters given actual parameters,
and it causes full-blown analysis of this specialization of the template.
For example, you declare an object of the template type, or you call a
templated function. At that point the template definition is expanded to
actual, ordinary C++ code (the template instance), which is subject to the
usual C++ compilation (OK, some rules, e.g. about multiple definitions, are
slightly different). You can also instantiate a template without using it, via
special syntax.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?