torhu wrote: > You can use typeof to get the common type, like this: > > typeof(T + U) max(T, U)(T arg1, U arg2) > { > return arg1 > arg2 ? arg1 : arg2; > } The + isn't always defined, so you can use: typeof(true ? cast(T)0 : cast(U)0) max(T, U)(T x1, U x2) { return x1 > x2 ? x1 : x2; }