auto ref is on the docket

kinke via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 23 11:33:49 PDT 2015


On Tuesday, 23 June 2015 at 18:11:21 UTC, bitwise wrote:
> On Mon, 22 Jun 2015 19:09:45 -0400, Timon Gehr 
> <timon.gehr at gmx.ch> wrote:
>
>> There is no reason to prevent templates from using the 
>> mechanism that generates only one copy. The two mechanisms 
>> shouldn't share the same syntax, because then there is no way 
>> to tell them apart for template functions.
>
> You would be losing the optimization of passing primitive types 
> by value, wouldn't you?

Not if you keep the current `auto ref` template syntax AND 
introduce another syntax `scope ref` for non-escapable references 
also accepting rvalues.


More information about the Digitalmars-d mailing list