Suppose I have a class Foo with a std::string member str. What should get_str return?
std::string Foo::get_str() const{ return str;}or
const std::string& Foo::get_str() const{ return str;}What is more idiomatic in C++?
Suppose I have a class Foo with a std::string member str. What should get_str return?
std::string Foo::get_str() const{ return str;}or
const std::string& Foo::get_str() const{ return str;}What is more idiomatic in C++?