MIN MAX problem

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Wed Mar 14 12:47:46 PDT 2007


Andrei Alexandrescu wrote:

> Is there a plan to allow:
> 
> typeof(true ? x1 : x2) max(T, U)(T x1, U x2)
> {
>     return x1 > x2 ? x1 : x2;
> }

Is it impossibly hard or ambiguous to allow the compiler to infer the
return type here? Something like

> auto max(T, U)(T x1, U x2)
> {
>     return x1 > x2 ? x1 : x2;
> }



More information about the Digitalmars-d mailing list