15 Apr
2009
15 Apr
'09
6:31 p.m.
Dominique Devienne wrote:
PS: is returning a const shared_ptr<T>& is better/worse than a copy?
My rule of thumb is: pass by const reference, return by value. I keep having to change other people's code when a method is declared to return const std::string&, and suddenly I need to return a string expression rather than a reference to a data member. Even more irksome is when that signature is declared on a virtual method. Then -- to change the computation of one return value in one override -- I must run around changing *every* signature.