title: vector serialization
body: <p>I am trying to binary serialize the data of vector. In this sample below I serialize to a string, and then deserialize back to a vector, but do not get the same data I started with.  Why is this the case?</p>
  
  <pre><code>vector&lt;size_t&gt; v;
  v.push_back(1);
  v.push_back(2);
  v.push_back(3);
  
  string s((char*)(&amp;v[0]), 3 * sizeof(size_t));
  
  vector&lt;size_t&gt; w(3);
  strncpy((char*)(&amp;w[0]), s.c_str(), 3 * sizeof(size_t));
  
  for (size_t i = 0; i &lt; w.size(); ++i) {
      cout &lt;&lt; w[i] &lt;&lt; endl;
  }
  </code></pre>
  
  <p>I expect to get the output </p>
  
  <pre><code>1  
  2
  3
  </code></pre>
  
  <p>but instead get the output </p>
  
  <pre><code>1
  0
  0
  </code></pre>
  
  <p>(on <a href="http://ideone.com/bXjuM" rel="noreferrer">gcc-4.5.1</a>)</p>