Const ref and rvalues again...

Jonathan M Davis jmdavisProg at gmx.com
Sun Nov 4 19:25:52 PST 2012


On Sunday, November 04, 2012 20:43:36 Andrei Alexandrescu wrote:
> On 11/4/12 7:58 PM, martin wrote:
> > I find it sad that while this topic seems to be of high priority for
> > quite a lot of language users, it is seemingly neglected by the head of
> > language development (Walter, Andrei etc.).
> 
> I was hoping "auto ref" solves this problem. I think it's currently only
> implemented for templates.

And when we argued for altering it so that it operated like const ref in C++ 
(which allows const ref in D to continue to function like it does now), some 
folks complained, because they've found the current semantics of auto ref to 
be useful (something to do with propagating the exact, original type, I 
think).

Now, since auto ref currently only works with templates, maybe we can keep its 
current semantics with templated functions but alter them for non-templated 
functions so that it works like const ref does in C++. The downside is that 
the semantics for auto ref between templated functions and non-templated 
functions are slightly different, but they're close enough that I'm not sure 
that it matters.

- Jonathan M Davis


More information about the Digitalmars-d mailing list