Taking the address of an rvalue struct

Peter Alexander peter.alexander.au at gmail.com
Fri Jul 22 11:30:26 PDT 2011


On 22/07/11 6:26 PM, Andrei Alexandrescu wrote:
> On 7/22/11 12:10 PM, dsimcha wrote:
>> == Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s
>> article
>>> This has long been a feature that I attempted to remove several times.
>>
>> What? Taking the address of this? Invoking methods on rvalue structs?
>
> The latter.

How would you stop it though without totally crippling the language?

e.g. if I have a struct Vec3, I would expect to be able to do:

Vec3 a = Vec3(1, 0, 0) + Vec3(0, 1, 0);


How would you accomplish that without calling Vec3.opBinary!"+" on an 
rvalue Vec3?


More information about the Digitalmars-d mailing list