Resolving conflicting functions

Bill Baxter dnewsgroup at billbaxter.com
Mon Dec 3 18:18:56 PST 2007


Derek Parnell wrote:
> On Tue, 4 Dec 2007 00:57:59 +0000 (UTC), BCS wrote:
>> you can't have a template and non-template by the same name
> 
> Yeah, I guess so. But why?
>  
>> here is the nasty solution, ther might be a better one, but this should work.
>>
>> // ------------------------
>> Ret!(T) opDiv(T)(T pFactor)
>> // ------------------------
>> {
>>   Ret!(T) temp;
> 
> Ummm ... what is 'Ret!' and where can it be found?
> 

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; }
}

Makes programming with templates lots of fun, huh?  :-)

--bb


More information about the Digitalmars-d-learn mailing list