Re:Libc++'s Implementation of std::string
by kccqzy on Friday January 31, 2020 @12:22AM
(#22199308)
That's not an answer. The STL has to have a non-const version that returns some kind of reference. Because C++ strings are mutable and even something like
s[3] = 'h';
involves forming a mutable reference and then assigning its pointee.
The way I think about it, to make CoW strings really usable in C++, you basically have to make strings immutable, like many newer languages like Python. That ship has sailed by the time standardization for C++ happened.
The way I think about it, to make CoW strings really usable in C++, you basically have to make strings immutable, like many newer languages like Python. That ship has sailed by the time standardization for C++ happened.