title: Fast move CString to std::string
body: <p>I'm working in a codebase with a mixture of <code>CString</code>, <code>const char*</code> and <code>std::string</code> (non-unicode), where all new code uses <code>std::string</code> exclusively. I've now had to do the following:</p>
  
  <pre><code>{
      CString tempstring;
      load_cstring_legacy_method(tempstring);
      stdstring = tempstring;
  }
  </code></pre>
  
  <p>and worry about performance. The strings are DNA sequences so we can easily have 100+ of them with each of them ~3M characters. Note that adjusting <code>load_cstring_legacy_method</code> is not an option. I did a quick test:</p>
  
  <pre><code>// 3M
  const int stringsize = 3000000;
  const int repeat     = 1000;
  
  std::chrono::steady_clock::time_point startTime = std::chrono::steady_clock::now();
  for ( int i  = 0; i &lt; repeat; ++i ){
      CString cstring('A', stringsize);
      std::string stdstring(cstring); // Comment out
      cstring.Empty();
  }
  std::cout &lt;&lt; std::chrono::duration_cast&lt;std::chrono::milliseconds&gt;(std::chrono::steady_clock::now() - startTime).count() &lt;&lt; " ms" &lt;&lt; std::endl;
  </code></pre>
  
  <p>and commenting out the <code>std::string</code> gives <code>850 ms</code>, with the assignment its <code>3600 ms</code>. The magnitude of the difference is suprising so I guess the benchmark might not be doing what I expect. Assuming there is a penalty, is there a way I can avoid it?</p>