3 ms·
This is true as long as your implementation doesn't call any functions that take a `const string&`. If you need to call such a function, then you first have to
by alexhutcheson 8y ago
This is true as long as your implementation doesn't call any functions that take a `const string&`. If you need to call such a function, then you first have to make a copy of your string_view into a new string object before you call it.
- saagarjha 8y agoIs there a way to do this without involving the overhead of a full copy, though?
- alexhutcheson 8y agoNot that I'm aware of - a const std::string& parameter needs to be a reference to a std::string object, and there's no guarantee that a given string_view object is pointing to a std::string.