By getting string_view
in C++17 we got cheap method of passing both std::string
and char*
to functions that do not take ownership of the s
Yes.
The problem with std::string_view
is that it doesn't remember if it points to a null-terminated string or not.
If you're writing a wrapper for a C api that uses null-terminated strings, you would have to constantly copy your std::string_view
s into std::string
s to make sure you have null-terminators.