Saturday, January 18, 2014

template specialization and instantiation

Instantiation and Specialization : templates tutorial
The process of creating a regular class, function, or member function from a template by substituting actual values for its arguments is called template instantiation. This resulting entity (class, function, or member function) is generically called a specialization.

However, in C++ the instantiation process is not the only way to produce a specialization. Alternative mechanisms allow the programmer to specify explicitly a declaration that is tied to a special substitution of template parameters. Such a specialization is introduced by template<>:

Strictly speaking, this is called a so-called explicit specialization (as opposed to an instantiated or generated specialization).

Specializations that still have template parameters are called partial specializations:

When talking about (explicit or partial) specializations, the general template is also called the primary template.

See Also:


No comments:

Post a Comment