My question is simple: if I have some class Man and I want to define member function that returns man's name, which of the following two variants shall I prefer?
First:
string name();
Second:
void name(/* OUT */ string &name);
The first variant is kind of inefficient because it makes unnecessary copies (local variable -> return value -> variable in the left part of assignment).
The second variant looks pretty efficient but it makes me cry to write
string name;
john.name(name);
instead of simple
string name(john.name());
So, what variant shall I prefer and what is the proper trade-off between efficiency and convenience/readability?