
std::string and Reference Counting
The Standard’s specification of class std::string is formulated to allow a reference counted implementation. However, this is not a requirement. A reference counted implementation must have the same semantics as a non-reference counted one. For example: string str1(“xyz”);string::iterator i = str1.begin();string str2 = str1;*i = ‘w’; //must modify only str1