Question about auto ref

Steven Schveighoffer schveiguy at yahoo.com
Fri Mar 15 09:38:29 PDT 2013


On Fri, 15 Mar 2013 12:32:35 -0400, Namespace <rswhite4 at googlemail.com>  
wrote:

> But it works already for templates.
> So if it's confusing, then, why was it introduced?

The way it works for templates is to generate two separate functions, one  
which takes ref and one which takes by value.

The proposed auto ref would generate ONE function, and just generate a  
temporary lvalue for any rvalues passed to it.  Templates would not be  
required.

There are pros and cons for both implementations.

The reason it was introduced (and this is hearsay, I was not involved) is  
because Walter misunderstood the original intention.

-Steve


More information about the Digitalmars-d-learn mailing list