lets say I have the functions
std::Vector<Point> calculate() {
std::Vector<Point> points; //do stuff with points
return points;
}
and
void calculate(std::Vector<Point>& points) {
//do stuff with points
}
So my question is specific to objects initialized on the stack, and are stl objects. Is there any difference in performance, and what is the popular method of doing it
regards
Taking the value as a reference parameter has the following properties:
Returning the value has the following properties:
[[nodiscard]]
attribute can be used in cases where discarding the value is categorically incorrect.