title: how copy the first elements of pair in vector to another vector?
body: <p>I have a std::vector with element of the type std::pair. With some algorithm, I return two iterators (range) so I would like to pick up all elements within that range and copy the first entry of the pair to another vector</p>
  
  <pre><code>std::vector&lt; pair&lt;double, int&gt; &gt; data;
  std::vector&lt;double&gt; data2;
  std::vector&lt; pair&lt;double, int&gt; &gt;::iterator it1, it2;
  
  for (;it1!=it2; it1++)
  {
    data2.push_back(it1-&gt;first);
  }
  </code></pre>
  
  <p>Using a loop will do that but I wonder if there is a straightforward stl algorithm to do that. Since the data size if pretty big and above operation will be repeated for many times, using a loop is pretty slow.</p>