News for hackers. Stuff that matters.
Re:Free Pascal by benibela on Monday December 14, 2020 @06:28PM (#25424829)
>Is returning references frequently done in C++?

It is rather common to avoid copying returned objects. (perhaps it becomes less common with std::move ?)

For example, the [] operator on the standard collections returns a reference, so the item can be modified

There Pascal has another clever idea. You can overload [] for reading and writing separately. Then x[k] := v becomes x.setItem(k, v)

There are no comments on this comment yet.