I want to be able to define
template <class TX>
void f(const TX &x){ ... }
template <class TY>
void f(const TY &x){ ... }
where TX must be derived from BaseX and TY must be derived from BaseY (how do I specify this kind of thing?), and I want to be able to call it as
f(DerivedX<T>())
It is most important that I can avoid specifying the template parameters. Is this possible, and if so how would I implement it? If it's not possible, is there a way I can make a templated function accept only certain types, but still have it be implicitly instantiated? I cannot just make the overloads of f accept the base class because I need the derived class' type.