3 ms·
It's a replacement for heap-allocated C strings. If you want to use std::string operations on an array of characters that you don't own or that are part of an
by twoodfin 11y ago
It's a replacement for heap-allocated C strings.
If you want to use std::string operations on an array of characters that you don't own or that are part of an indivisible larger structure, you're out of luck.
It's not difficult to craft a slice-like replacement, but range types will be most welcome when they finally hit the standard.
- vinkelhake 11y agoFWIW, string_view is on its way. Both libc++ and libstdc++ ship with implementations of it (in the std::experimental namespace). http://en.cppreference.com/w/cpp/experimental/basic_string_view http://en.cppreference.com/w/cpp/experimental/basic_string_v...