title: c++ how to shrink std::vector to a subselection efficiently
body: <p>given two vectors</p>
  <pre><code>std::vector&lt;SomeStruct&gt; items;  //1'000'000 items
  std::vector&lt;int&gt; selection;  //900'000 unique indices in ascending order
  </code></pre>
  <p>where <code>selection</code> contains valid indices into <code>items</code>, how can I shrink <code>items</code> efficiently to only contain the elements that are initially indexed by <code>selection</code>?</p>