Hacker News new | ask | show | jobs
by twoodfin 4035 days 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.

1 comments

FWIW, 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_v...