title: C++ STL String Copy Constructor - Always a Deep Copy?
body: <p>I've seen various conflicting references to the copy constructor behaviour of STL strings in C++ and I was hoping someone could clarify this for me, given the following code segment:</p>
  
  <pre><code>string str() { return string("this is a string"); }
  //meanwhile, in some other function...
  string s = str();
  </code></pre>
  
  <p>Does the object 's' constitute a deep copy of the string object defined in the function 'str()'? or is the object 's' simply pointing at the same chunk of memory allocated during the string constructor call in the 'str()' function?</p>