Passing rvalues to functions expecting const ref
Namespace
rswhite4 at googlemail.com
Sun Dec 23 12:40:08 PST 2012
On Sunday, 23 December 2012 at 18:32:47 UTC, John Chapman wrote:
> On Sunday, 23 December 2012 at 12:08:47 UTC, Namespace wrote:
>> As long as you use structs this should work, as you can see
>> here: http://dpaste.dzfl.pl/03adf3d1
>> But if you use classes, it does not work anymore. So I like it
>> a lot, that it works with structs. :)
>
> I don't think this will work after 2.061 is released. The
> behaviour is changing to disallow struct literals as lvalues.
I hope not. As long as "auto ref" don't work for normal
functions, this change would be very inconvenient...
Minas Mina:
Show me the whole code, I think that your opBinary functions
returns rvalues.
This would be a good and important case for "auto ref". But until
now it is only for template paramters...
More information about the Digitalmars-d-learn
mailing list