While reading this, I\'m confused by the following examples:
// Example 2: Explicit specialization
//
template // (a) a base template
void
It's the order but it's not only the order. For the first code, both templates was defined before. But the second was taken.
This is because the two templates are compared and it is found that (T)
matches any type that (T*)
matches, but that (T*)
does not match all types that (T)
matches. Thus, the second template is more specialized. Whenever you put an explicit specialization and those two templates match, the templates are compared and the more specialized one is associated by the explicit specialization. This comparison is called "partial ordering".