It is not possible to define a partial specialization of a function template in C ++, so your second example defines overloading, not specialization. Because the standard allows you to add specializations to the std , your overloading is illegal.
Is this still true in C ++ 11?
Yes.
Also, is this applicable to template classes (e.g. std :: hash) or just to template functions?
In any case, you cannot overload class templates; you can only overload functions. The same rules apply, however, you can only specialize in a class template if the specialization depends on a custom (i.e. non-standard) type.
Is there a specific reason for not overloading, as in the second case above? (what could potentially break in theory?)
As one example, an implementation may want to take the address of the function, but if you overload the function, then using the address can cause ambiguity and not compile, that is, you just violated the valid code in the standard library.
Jonathan wakely
source share