3 ms·
I would think that (in C++14 at least), std::string_view would be more appropriate than both? http://en.cppreference.com/w/cpp/header/experimental/string_view
by dbaupp 12y ago
I would think that (in C++14 at least), std::string_view would be more appropriate than both?
http://en.cppreference.com/w/cpp/header/experimental/string_view http://en.cppreference.com/w/cpp/header/experimental/string_...
- deleted 12y ago[deleted]
- seabee 12y agoUsing string_view in this example doesn't solve the use-after-free bug. If you are concerned about memory safety, the only appropriate choices are to copy the string and have the string_view objects share ownership, or to use the primitive index range idea and punt the problem back to the programmer.
- dbaupp 12y agoYep, definitely, I was just responding to the question of which view-into-a-string type is the most appropriate.