Assume we have a simple getter method in a class that returns a const reference to a std::string member:
const std::string& getString() const noexcept { return someString; }
With the advent of std::string_view in C++17, I wonder whether it has any advantages of writing this instead:
const std::string_view getString() const noexcept { return someString; }
Does one method have advantages/disadvantages over the other? Clearly (correct me if I'm wrong) both solutions will definitely be better than this:
const char* getString() const noexcept { return someString.c_str(); }
I've seen this related question, but I'm asking for something slightly different.