title: std::string in struct - Copy/assignment issues?
body: <p>Suppose I have a struct containing a std::string, like this:</p>
  
  <pre><code>struct userdata{
          int uid;
          std::string username;
      }
  </code></pre>
  
  <p>Do I need to create a copy ctor or anything to return it from a function or to use it inside a STL container? Consider this function:</p>
  
  <pre><code>userdata SomeClass::GetUserData(unsigned int uid)
  {
      //do error checking and other stuff...
      //m_usermap is std::map&lt;unsigned int, userdata&gt;
      return m_usermap[uid];
  }
  </code></pre>
  
  <p>When I insert userdata structs into the std::map, a copy of the struct gets created, right? Does a new std::string get created using the value of the username field, or does some sort of bitwise copy happen (this would be bad)? Similarly, when I return a userdata struct from the GetUserData method, does it have an independent string holding the username or do I need to define a copy ctor and explicitly create a new string?</p>