News for hackers. Stuff that matters.
Re:C++ 20: The Core Language by missblit on Tuesday November 05, 2019 @09:40PM (#21459243)
It's possible I'm just used to it, but I've never found std::string more complicated than, say, python (what's up with unicode in 2 vs 3?) or JavaScript (UTF-16 = surrogate pair pain).

It's essentially a std::vector<char> with a few random convenience features bolted on.

I guess some of the confusing points are: not unicode aware, string literals aren't std::strings by default, c_str returns a pointer to a buffer with length one greater than the string length, and the usual C++ quirks like why is there both data and c_str?

Re:C++ 20: The Core Language by saagarjha on Tuesday November 05, 2019 @10:27PM (#21459502)
> the usual C++ quirks like why is there both data and c_str

The usual C++ response: for backwards compatibility, because data was not required to null-terminate prior to C++11.