title: c std::vector splitting into two
body: <p>Is there an easy and run-time efficient way to take a std::vector&lt;> in c++ and split it in half into two other vectors?</p>
  
  <p>Because right now I'm doing this: </p>
  
  <pre><code>std::vector&lt;&gt; v1, v2;
  for(int i = 0; i &lt; vector.size(); i++)
  {
      if(i &lt; vector.size()/2) v1.push_back(vector[i]);
      else v2.push_back(vector[i]);
  }
  </code></pre>
  
  <p>which runs in O(n) time and this is an operation I have to perform quite frequently. So is there a better way? </p>