Hacker News new | ask | show | jobs
by anton_gogolev 4035 days ago
A C string could be just as well replaced with a std::vector<char> (or a wide variant thereof) without any significant loss of functionality.

std::string is an embarassement. It's both bloated (why, we need to have both iterator-based and index-based access interfaces!) and lacks basic string manipulation functionality, it's encoding-unaware.

1 comments

- std::string is old. It predates the rest of the STL, and had an index interface prior to the iterator based one. The old API was left in for compatibility and imposes no runtime overhead

- It has all the string manipulation capability of the C standard library

- Being encoding unaware was probably a blessing given how unicode has evolved since std::string was introduced (20-30 years ago?)