title: Copy struct to vector
body: <p>Say I have a structure of various data types, I want to copy each single byte in a vector. I do this:</p>
  
  <pre><code>vector&lt;unsigned char&gt; myVector;                                     // get a vector
  unsigned char buf[sizeof myStructure];                              // get an array
  memcpy(&amp;buf, &amp;myStructure, sizeof myStructure);                     // copy struct to array
  myVector.insert(myVector.begin(), buf, buf + sizeof myStructure);   // copy array to vector
  </code></pre>
  
  <p>Is there a quickest way that allows me to copy the struct <code>myStruct</code> to vector <code>myVector</code> without passing through the array <code>buf</code>?</p>