This is a completely wrong syntax. When you specialize in patterns, you must include angle brackets with the types for which you specialize. For instance:.
template<typename T> struct X { ... }; template<> struct X<int> { ... };
So,
template<> void X::set(std::string &) { ... }
doesn't specialize in anything, he implements
class X { template<> void set(std::string &) { ... } };
which is a completely different function. I do not understand why gcc did not raise an error because the class does not have this member.
Now, even if you used the supposedly correct syntax, that would be wrong, because, as Tom already answered, you cannot specialize functions (just reload the version without the template). In C ++ 03, that is; it is allowed in C ++ 0x.
source share