title: C++ : how to duplicate std::string *
body: <p>How can I, in c++, duplicate a std::string * ?</p>
  
  <p>I want to do something like that :</p>
  
  <pre><code>std::string *str1 = new std::string("test");
  std::string *str2 = strdup(str1);
  
  delete str1;
  
  std::cout &lt;&lt; *str2 &lt;&lt; std::endl; // result = "test"
  </code></pre>