Resolving conflicting functions

BCS ao at pathlink.com
Tue Dec 4 09:28:11 PST 2007


Reply to Daniel,

> Derek Parnell wrote:
> 
>> On Tue, 04 Dec 2007 11:18:56 +0900, Bill Baxter wrote:
>> 
>>> You'll have to make it. A little static if template like
>>> 
>>> template Ret(T) {
>>> static if (is(T==Currency)) { alias real Ret; }
>>> else { alias Currency Ret; }
>>> }
>> I almost go it right. Yes this works. There has got to be a better
>> way!
>> 
> You think that's bad; try doing it for a matrix library where the
> return type depends on the input types which contain a mix of scalars,
> vectors, matrices and transforms (special matrices which have an
> implicit final row.)
> 
> Hopefully the promised overloading upgrades will help with this.
> 
> -- Daniel
> 

this would be a nice place to have auto:


auto Fn(A, B, C)(A a, B b, C c)
{
/// lots-o-logic

   return ret; // return type defined here.
}




More information about the Digitalmars-d-learn mailing list