Say we have an utility function:
std::string GetDescription() { return "The description."; }
Is it OK to return the string literal? Is the implicitly created std::string
object copied?
I thought about always returning it like this:
std::string GetDescription() { return std::move(std::string("The description.")); }
But it's of course longer and more verbose. We could also assume that compiler RVO will help us a bit
std::string GetDescription() { return std::string("The description."); }
Yet still, I don't know what it really has to do, instead of what can it do.