R-values and const ref
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Thu Sep 9 10:03:17 PDT 2010
On 9/9/10 6:32 CDT, Steven Schveighoffer wrote:
> On Thu, 09 Sep 2010 06:08:14 -0400, Eldar Insafutdinov
> <e.insafutdinov at gmail.com> wrote:
>
>> A while back dmd stopped allowing rvalues as ref function arguments. I
>> entirely understand why it was done, but the same restriction applies
>> to the
>> ref const function parameters. This causes a lot of pain and at the
>> moment
>> makes me use pass-by-value parameters(most notably when using
>> structs). C++
>> doesn't have any problem with const ref and rvalues. Can we please
>> restore
>> this behavior for const ref?
>
> auto ref is supposed to handle that. However, I think it only works on
> templates.
Indeed, auto ref must work with non-templates.
Andrei
More information about the Digitalmars-d
mailing list