Before C ++ 11, if I had a function working on large objects, my instinct would be to write functions with such a prototype.
void f(A &return_value, A const ¶meter_value);
(Here, return_value is just an empty object that will receive the output of the function. A is just some class that is large and expensive to copy.)
In C ++ 11, using move semantics, the default recommendation (as I understand it) is simpler:
A f(A const ¶meter_value);
Is there still a need to do this in the old way, passing in an object to store the return value?
source
share