4 ms·
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
by anton_gogolev 11y 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.
- nly 11y ago- 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?)