I have a class:
template<typename T>
class Foo
{
public:
...
Foo& operator=(const Foo&) { ... }
};
And I would like to specialize Foo<std::string> to add a Foo<std::string>::operator=(const char*) overload and to reuse the rest of the Foo<T> implementation. Is it possible for the Foo<std::string> specialization to leverage the non-specialized implementation, or must I move the Foo<T> implementation into a separate base class that Foo<T> and the Foo<std::string> specialization derive from?
Multiple specializations of a template are unrelated types. As you mention in the question a common approach is to move most of the functionality to a base class to reuse it.
There are two proposals for C++1x that would allow for a cleaner way of expressing the intent by means of a new construct
static if, although both proposals have some issues to solve before they get accepted, and then you would have to wait for the standard to be approved and then compilers to catch up… still just as exercise for the mind the proposed syntax would not use an explicit specialization, but rather tailor the generic template: