Risks Using string_view
Explore the key risks of using std string_view in C++17, focusing on its non-owning nature, lifetime issues with temporary objects, and challenges with non-null-terminated strings. Learn to manage these risks effectively to use string_view safely in your C++ code.
We'll cover the following...
We'll cover the following...
std::string_view was added into the Standard mostly to allow performance optimizations. Nevertheless, it’s not a replacement for strings! That’s why when you use views you have to remember about a few potentially risky things:
Taking Care of Not Null-Terminated Strings
string_view may ...