title: unique_ptr after call to c_str() doesn't point to valid value
body: <p>Why after the call c_str() unique_ptr no longer points to valid wstring?</p>
  
  <pre><code>wstring encrypt = L"hello";
  LPCWSTR decrypted = DecryptString(&amp;EncryptString(encrypt)[0]).get()-&gt;c_str();    
  
  unique_ptr&lt;wstring&gt; DecryptString(LPCWSTR str)
  {
      unique_ptr&lt;wstring&gt; decryptedStr = make_unique&lt;wstring&gt;();
      decryptedStr.get()-&gt;resize(wcslen(str) / sizeof(WCHAR) + 1);
  
      wstring key = L"123";
  
      for (int i = 0; i &lt; wcslen(str) / sizeof(WCHAR); i++)
      {
          (*decryptedStr.get())[i] = str[i] ^ key[i % key.size()];
      }
  
      return decryptedStr;
  }
  </code></pre>