Resolving conflicting functions

Bill Baxter dnewsgroup at billbaxter.com
Mon Dec 3 20:50:57 PST 2007


Derek Parnell wrote:
> On Tue, 04 Dec 2007 11:23:18 +0900, Bill Baxter wrote:
> 
>> I think in D2 you should be able to use typeof(return) to remove the 
>> need for the extra helper template, Ret.
>> Totally untried though.
>>
>> // ------------------------
>> typeof(return) opDiv(T)(T pFactor)
>> // ------------------------
>> {
>>   static if(is(T == Currency))
>>     return  mData / pFactor.mData;
>>   else
>>     return  this.mData / pFactor;
>> }
>>
>> --bb
> 
> Nope. "typeof(return) must be inside a function"
> 

Dang.  I had high hopes for that new feature to clean things up.

--bb


More information about the Digitalmars-d-learn mailing list