title: Extract elements from a given stl container with given predicate to another container
body: <p>What is the best way to extract and move elements that meet certain criteria from a STL container to another STL container (e.g., <code>vector</code>). For example:</p>
  
  <pre><code>std::vector&lt;int&gt; original {1, 2, 6, 7, 9, 34, 9, 7, 3}
  
  // For example, I only need event numbers
  auto criteria = [](const int a) -&gt; bool { return a%2 == 0? }
  
  std::vector&lt;int&gt; newvec = ...;
  </code></pre>
  
  <p>So, what I want after the operation is</p>
  
  <pre><code>original = {1, 7, 9, 9, 7, 3}
  newvec = {2, 6, 34}
  </code></pre>
  
  <p>An elegant solution will be appreciated.</p>