title: Feed std::vector<unsigned char> from unsigned char *
body: <p>i have write this piece of code:</p>
  
  <pre><code>unsigned char *buffer = ...
  ...
  std::vector&lt;unsigned char&gt; vec(buffer,128);
  </code></pre>
  
  <p>This works but i would like to feed the vector after its declaration (suppose the vector is a field of a class)</p>
  
  <pre><code>unsigned char *buffer = ...
  ...
  std::vector&lt;unsigned char&gt; vec;
  ...
  vec = vec(buffer,128) ???
  </code></pre>
  
  <p>I do not know what to do on the last line.
  The only thing that actually works is to resize the vector then do a memcpy. Is there a better way?</p>