UFCS and operator overloading

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Tue May 8 12:10:02 PDT 2012


"Timon Gehr" <timon.gehr at gmx.ch> wrote in message 
news:jobo5r$1cf7$1 at digitalmars.com...
> On 05/07/2012 10:37 PM, Nick Sabalausky wrote:
>>
>> I don't know why that doesn't work (unless you just need to make it "auto 
>> c
>> = a + b;" so it isn't a "statement has no effect"?), but FWIW that's not 
>> an
>> example of UFCS. UFCS would mean calling your opBinary above like this:
>>
>> a.opBinary!"+"(b)
>>
>> Instead of this:
>>
>> opBinary!"+"(a, b)
>>
>>
>
>  a + b => a.opBinary!"+"(b) => opBinary!"+"(a, b)
>        ^                    ^
> standard rewrite           UFCS
>

/facepalm

Yea, I get it now ;)




More information about the Digitalmars-d mailing list