Problem With The Initial Example
We've learned about several risks associated with std::string_view. Let's check if they apply to the first example in this section.
We'll cover the following...
The intro section showed you an example of:
Press + to interact
std::string_view StartFromWord(std::string_view str, std::string_view word){return str.substr(str.find(word)); // substr creates only a new view}
The code doesn’t have any issues with non-null-terminated strings - as all the functions are from the string_view
API.
However, how ...