extending namespace std via partial template specialization
问题 As far as I know, we are allowed (with some exceptions that I won't mention here) to "extend" namespace std by totally specializing a std template function such as std::swap , i.e. namespace std { template<> void swap<Foo>(Foo& lhs, Foo& rhs){...} } is perfectly valid. Since C++11, we can now partially specialize functions. I believe that we can then play the same game and extend std via partial specialization, like namespace std { template<typename T> void swap<Foo<T>>(Foo<T>& lhs, Foo<T>&