Resolving conflicting functions
Daniel Keep
daniel.keep.lists at gmail.com
Mon Dec 3 22:11:38 PST 2007
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
More information about the Digitalmars-d-learn
mailing list