rvalue references

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 2 20:43:09 PDT 2015


On Tue, 02 Jun 2015 23:23:00 -0400, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> On Wednesday, 3 June 2015 at 03:20:48 UTC, bitwise wrote:
>> Anyways, moving forward with the assumption that the meaning of 'in'  
>> will
>> not change, I still don't understand. Why couldn't 'in ref' be allowed  
>> to
>> accept rvalues in addition to 'auto ref'?
>
> For the same reasons that we can't have const ref accept rvalues,  
> especially since in ref basically _is_ const ref in most cases right now.
>
> - Jonathan M Davis

Why can't const ref accept rvalues?

const being too restrictive doesn't seem like a real reason, because
although its undesirable for some cases, doesn't mean it can't be useful
in a _lot_ of other cases.

Also, with DIP25, isn't 'const ref' the same thing that 'const scope ref'  
was
supposed to be anyways?

I can't remember right now what the reasoning was for 'const ref' not to  
take
rvalues in the first place. I think it was that you could escape the  
reference,
but this isn't true anymore with DIP25 right?

   Bit


More information about the Digitalmars-d mailing list