string_view is about expressiveness and design flexibility (vector<char> and char* can trivially convert) that safety.
That being said, string_view is arguably safer than passing around a char* and a length.
That being said, string_view is arguably safer than passing around a char* and a length.
Literally had to write a psuedo borrow checker to stop it: https://youtu.be/80BZxujhY38?t=1095
So much work rather than admit the interface is bad and you should feel bad.
C++: "shoot yourself in the ~~foot~~ face."
I'm not entirely sold on string_view or span yet. But I wasn't sold on tuples either and I use them a lot now.
That being said, yes, string semantics are hard. Passing around copies of a string buffer (std::string) or calling to_string_view everywhere don't seem better.