BCS:
> auto Foo(A,B)(A a, B b)
> {
> if(a<b)
> return Foo(++a, --b);
> else if(a == b)
> return b;
> else
> return a;
> }
Maybe for such things you need a type inferencer plugged into a "modern" type system, like the ones you can find in ML or Haskell.
Bye,
bearophile