[Answered] What are the benefits of passing an argument as an rvalue? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

[Answered] What are the benefits of passing an argument as an rvalue?

For example, we have the following function declaration: int func(int&& rval_arg); What could I do with this rvalue parameter, that I can't do with a regular one? When should I use it?

12th May 2022, 7:55 PM
Xemonix
Xemonix - avatar
3 Answers
+ 5
Mihir Lalwani AS well AS a regular lvalue reference. Anyways, I got an in depth answer in another place, so I can close this question
14th May 2022, 6:35 PM
Xemonix
Xemonix - avatar
+ 2
You can change the value of it by passing as argument..
14th May 2022, 6:26 PM
Mihir Lalwani
Mihir Lalwani - avatar
+ 2
Okay
15th May 2022, 3:21 AM
Mihir Lalwani
Mihir Lalwani - avatar