Const ref and rvalues again...
Malte Skarupke
malteskarupke at web.de
Sun Nov 4 19:48:28 PST 2012
On Monday, 5 November 2012 at 03:26:10 UTC, Jonathan M Davis
wrote:
> 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
Yes, please. Auto ref for non-template functions would solve the
problem exactly. I also like it because then the intent of the
programmer is clear.
More information about the Digitalmars-d
mailing list