3 ms·
The C++ spec includes the standard library. The COW optimization is a common one (although perhaps not anymore with C++11, see other comments). The C++ spec imp
by eridius 14y ago
The C++ spec includes the standard library. The COW optimization is a common one (although perhaps not anymore with C++11, see other comments). The C++ spec imposes certain requirements on the std::string interface that are the source of the problem documented in that link. In fact, the exact requirements of the C++ spec that cause the problem are talked about, along with an example of what a simple solution could have been (if it had been considered when C++ was being standardized).
So saying it's not C++ because it's standard library is at best a misunderstanding, at worst it's disingenuous. The C++ spec is the cause of this fundamental problem with any attempt at doing COW optimization of std::string.
- JoeAltmaier 14y agoSorry, I guess I'm too used to using C++ without any std library in sight. I write a lot of embedded code, where the library overhead is too great.