Revisiting Item 23: Don’t Try to Return a Reference When You Must Return an Object
While the title sounds rather generic, the main content is about what is appropriate to return from various operator functions.
SO has a more
In the case of binary operators, here is a good example of the function declaration/implementation:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Note the parameter lhs is passed into operator+
via copying.