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
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: