Rvalue references - The resolution

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon May 6 10:53:10 PDT 2013


On 5/6/13 1:45 PM, Steven Schveighoffer wrote:
> On Mon, 06 May 2013 13:28:18 -0400, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> On 5/6/13 12:17 PM, Steven Schveighoffer wrote:
>>> On Mon, 06 May 2013 12:03:27 -0400, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>> No. It's a very different thing handled by a special rule in C++.
>>>
>>> This isn't helping. You keep saying its different but not how.
>>
>> In one case a reference is returned, in the other an rvalue is returned.
>
> This is a trimmed down example:
>
> int &foo(int &val) { return val; }
>
> What I read from you (and I could be wrong) is you are saying this is
> not valid:
>
> foo(foo(foo(1)));
>
> Is that right?

No. I believe I was very specific about what I destroyed and in all 
likelihood so do you. Probably at this point we've reached violent 
agreement a couple of iterations back.

Long story short: binding rvalues to ref is fraught with peril and must 
be designed very carefully.


Andrei




More information about the Digitalmars-d mailing list