3 ms·
The changes to std::string were made because "the [pre-C++11] definition of basic_string allows only very limited concurrent access to strings. Such limited con
by aw1621107 2mo ago
The changes to std::string were made because "the [pre-C++11] definition of basic_string allows only very limited concurrent access to strings. Such limited concurrency will inhibit performance in multi-threaded applications." The proposed fix was to make "all iterator and element access operations safely concurrently executable." [0]. This involved limiting the circumstances in which iterators could be invalidated, which among other things meant that non-const operator[] could no longer invalidate iterators, which meant copy-on-write was no longer a viable implementation [1].
[0]: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2668.htm https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n26...
[1]: https://stackoverflow.com/q/12199710 https://stackoverflow.com/q/12199710
- jdw64 2mo agoThank you for the kind comment. !