#15 A value object is returned by reference.

open
nobody
None
5
2012-10-04
2010-11-22
Markus Elfring
No

The class "Ext2Partition" provides the following public interface so far.
string &get_linux_name();
https://github.com/mregmi/ext2read/blob/master/ext2read.h#L177

I find this approach wrong because value objects should not be returned by reference.

See also:
http://c2.com/cgi/wiki?ValueObject
http://en.wikipedia.org/wiki/Return_value_optimization
http://stackoverflow.com/questions/2182408/return-a-const-reference-or-a-copy-in-a-getter-function

Discussion