title: How to assign a value of a string to a std::unique_ptr<std::string>?
body: <p>After declaring an <code>std::unique_ptr&lt;std::string&gt;</code> but without assigning it (so it contains an <code>std::nullptr</code> to begin with) - how to assign a value to it (i.e. I no longer want it to be holding <code>std::nullptr</code>)? Neither of the methods I've attempted work.</p>
  
  <pre><code>std::unique_ptr&lt;std::string&gt; my_str_ptr;
  my_str_ptr = new std::string(another_str_var); // compiler error
  *my_str_ptr = another_str_var; // runtime error
  </code></pre>
  
  <p>where <code>another_str_var</code> is an <code>std::string</code> that is declared and assigned earlier.</p>
  
  <p>Clearly my understanding of what <code>std::unique_ptr</code> is doing is woefully inadequate...</p>