Hi!
I would like to know if it is possible to implement something like
this:
template <class X, class Y>
X void func(X, Y) { ... }
template <class X, class Y>
Y void func(X, Y) { ... }
The idea is that the compiler would choose the appropriate function
depending on the types of X and Y provided there exists some
compile-time criterium.
For example, given the concrete classes A and B (whereas B is derived
from A) I want to make sure that no matter in what order you provide
arguments to func(), the return value would be always A.
One of the solutions would be to put func() inside a template class and
use partial specialization, but that would not work if you deal with
overloading operators.
Are there any other options?
Thanks,
Andrei