rvalues -> ref (yup... again!)

MattCoder nospam at mail.com
Sat Mar 24 00:48:51 UTC 2018


On Friday, 23 March 2018 at 23:58:05 UTC, Jonathan M Davis wrote:
> On Friday, March 23, 2018 23:35:29 MattCoder via Digitalmars-d 
> wrote:
>> Well, to be honest I still can't understand why would you want 
>> to pass a RValue as reference.
>
> Well, it's frequently the case that you don't want to copy an 
> object if you don't have to...
> - Jonathan M Davis

Well the concept it's OK. (Differences between passing by value 
vs reference, copy etc.). Except for the const thing in C++, 
because I don't know this language, and by the way thanks for 
explaining that.

Question:

In C++ the signature of the function which will receive the 
references like in this case, need to be "const ref" parameters, 
right? - If yes, then since it's const ref parameter, will not 
change the value passed, even if it's lvalue, right?

Matt.




More information about the Digitalmars-d mailing list