title: Efficiently instantiate vector<char> from char*
body: <p>I have a hot spot in my code where I need to call a library function that takes a <code>vector&lt;char&gt; vec</code> and I have the data as a <code>char* data</code> along with a <code>size_t len</code> length. I currently do:</p>
  
  <pre><code>vec.reserve(len);
  std::copy(data, data+len, back_inserter(vec));
  </code></pre>
  
  <p>and like I said this is a hot spot. I wonder if copying one byte at a time is too slow and it would be faster to copy 4 or 8 bytes in each iteration. I'm also not aware that there's a way to populate a vector this way (since it requires writing to its <code>data()</code> member).</p>
  
  <p>Is there a way, maybe, to avoid the copy altogether?</p>