I wonder what is the reason of rvalue move is needed, while having lvalue pass by reference? If you have an lvalue which if passed by reference, will only have one copy in memory. Same applies to rvalue which "move"s using move constructor. Also only one copy in memory.
I can always pass a lvalue if I know if a function does not change the value of its parameter. I can redefine function's parameter as const&.
Aucun commentaire:
Enregistrer un commentaire