Frédéric Bron <frederic.b...@m4x.org> writes:

>> const string & as return type is madness.  For one thing, it's
>> guaranteed _not_ to be an efficiency gain in C++11.  For another, it
>> produces _serious_ destructor/lifetime issues.
>
> Of course I am not speaking of new strings created in the function!
> That would be stupid. But if you return a member of an object for
> example, it is stupid to return a copy of it (I do not know if this
> happens, however).

Not every object is persistent.  Again: references create life-time
issues.  Messing with them, particularly in the case of a basic
conceptually scalar data structure like "string" only makes some remote
sense when there is positive proof that there is a serious performance
impact for known implementations.

-- 
David Kastrup

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to