Operator overloading -- lets collect some use cases

Weed resume755 at mail.ru
Tue Dec 30 10:20:45 PST 2008


Frits van Bommel пишет:
> Don wrote:
>> Frits van Bommel wrote:
>>> Don wrote:
>>>> A straightforward first step would be to state in the spec that "the
>>>> compiler is entitled to assume that X+=Y yields the same result as
>>>> X=X+Y"
>>>
>>> That doesn't hold for reference types, does it?
>>
>> I thought it does? Got any counter examples?
> 
> For any class type, with += modifying the object and + returning a new one:

The += operator too should return the object (usually "this")



More information about the Digitalmars-d mailing list