title: resize std::string without initializing memory
body: <p>I'm using a C routine to write to an std::string's datafield. This is a contrived example, in reality I'm getting a non-null terminated string and its size via network:</p>
  <pre><code>#include &lt;string&gt;
  #include &lt;cstdio&gt;
  #include &lt;cstring&gt;
  
  const char* str = &quot;Some examplory string..&quot;; 
  
  int main()
  {
      std::string some_str;
      some_str.resize(strlen(str));
      std::strcpy(&amp;some_str.front(), str);
      printf(some_str.c_str());
  }
  </code></pre>
  <p>Now according to <a href="https://en.cppreference.com/w/cpp/string/basic_string/resize" rel="nofollow noreferrer">cppref</a> there's no overload for <code>resize()</code> which just resizes and does not initialize memory with '\0' or something else. But why should I pay for that if all I'm doing is overwriting it again? Can this somehow be avoided?</p>