rvalue references

anonymous anonymous at example.com
Tue Apr 23 01:28:23 PDT 2013


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.


More information about the Digitalmars-d mailing list