rvalue references

Namespace via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 2 11:06:31 PDT 2015


On Tuesday, 2 June 2015 at 17:22:07 UTC, Marc Schütz wrote:
> On Tuesday, 2 June 2015 at 16:02:56 UTC, Namespace wrote:
>> Thanks to DIP 25 I think it's time to review this again. I 
>> would implement it (if no one else wants to do it), but there 
>> are still some unanswered questions:
>>
>> 1. Is 'auto ref' still the chosen syntax (I guess so)?
>
> Why not `scope ref` (or `in ref` == `const scope ref`)?

See DIP 36

>> 2. Should auto ref for templates act like auto ref for 
>> non-templates (creates a temporary and pass it by ref) or 
>> should the current behaviour stay (duplicate the function 2^N 
>> times)?
>
> With `scope ref`, obviously it should stay as-is.
>
>> 3. What's with return ref, should auto ref for non-templates 
>> include return ref (like auto ref for templates)?
>
> Like above, no.
>
>> 4. What's with this constellation:
>>
>> struct S { }
>>
>> void ene(S) { }
>> void mene(ref S) { }
>> void muh(auto ref S) { }
>>
>> should 'mene' (ref) interfere with 'muh' (auto ref)?
>
> If overloading on `scope` is allowed, then yes, else no.


More information about the Digitalmars-d mailing list