TITLE: specializing template functions in namespace std (Source: editted private correspondence, 2 Feb 2001) AUTHOR: Jon Kalb [Kalb@LibertySoft.com] [snip] It turns out that this is legal: namespace std { template<> void swap(UserClass&a, UserClass&b) {...} } But this is not: namespace std { void swap(UserClass&a, UserClass&b) {...} } The rule in this case is that you can *specialize* but not overload a template function. So [the above] is out because it's not a template. namespace std { template void swap(UserTemplateClass&a, UserTemplateClass&b) {...} } And [the above is not legal] because it would require partial specialization. Which is only supported for template classes, not template functions. Something's got to give, because clearly the UserTemplateClass example has to have a solution. So we are either going to get overloading (as well as specialization) of standard template functions or we are going to get partial specialization of function templates. _______________________________________________ cpptips mailing list http://cpptips.hyperformix.com