I believe you are misinterpreting the "Change": this is not referring to the invalidation rules of data
and c_str
, but rather those of swap
.
This question gave me this idea, and I think I am correct when I read your quote and the linked question/answers.
Since basic_string
's swap can invalidate iterators, one can implement a SSO. In C++03, basic_string
was a reversible container, which means it had to comply with this requirement for swap
ping containers:
The expression a.swap(b), for containers a and b of a standard container type other than array, shall exchange the values of a and b without invoking any move, copy, or swap operations on the individual container elements.
I may be immensely wrong though, IANALL (I am not a language lawyer).