Hacker News new | ask | show | jobs
by flohofwoe 1161 days ago
I don't even know where to start with C++ stdlib string problems, but being mutable and doing a unique heap allocation (above a certain length - a behaviour which however isn't even standardized) are definitely at the top of the list.

std::string_view would have been a good thing if it hadn't added another memory corruption foot gun.

A universal string type is one of those things where you can either have convenience or performance, but never both.

1 comments

They are still better than str...() and mem...() all over the place, and all relevant C++ compilers have options to turn bounds checking on.