Template specializations
Template specializations allow us to make the generated template code differently for some types—not just the same code with different types substituted, but completely different code. There are two kinds of template specializations in C++—explicit, or full, specializations and partial specialization. Let’s start with the former.
Explicit specialization
Explicit template specialization defines a special version of the template for a particular set of types. In an explicit specialization, all generic types are replaced by specific, concrete types. Since an explicit specialization is not a generic class or function, it does not need to be instantiated later. For the same reason, it is sometimes called full specialization. If the generic types are fully substituted, there is nothing generic left. An explicit specialization should not be confused with an explicit template instantiation—while both create an instantiation of a template...