rvalue references

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Apr 23 07:25:37 PDT 2013


On 4/23/13 4:28 AM, anonymous wrote:
> On Tuesday, 23 April 2013 at 03:30:35 UTC, Walter Bright wrote:
>> Previous discussions:
>>
>> http://forum.dlang.org/thread/4F84D6DD.5090405@digitalmars.com#post-4F84D6DD.5090405:40digitalmars.com
>>
>>
>> http://d.puremagic.com/issues/show_bug.cgi?id=9238
>
> As far as I understand the "usability disaster" of disallowing rvalue
> references is that I have to define a non-ref overload forwarding to my
> function(ref arg).
> That ref can't be for functionality, because I'm expecting references to
> rvalues/temporaries. => ref is merely for performance, and the parameter
> can be const.
>
> Now, this may be too naive, but what about allowing the compiler to pass
> regular (not declared ref) const arguments per reference as it sees fit?
> It would be just another optimization.
>
> I'd declare function(const arg) and that would be it.

Aliasing would kill that. We considered it.

Andrei


More information about the Digitalmars-d mailing list