title: C++ std::transform vector of pairs->first to new vector
body: <p>Sorry for a little bit beginner question. There are vector and vector of pairs</p>
  
  <pre><code>typedef std::vector &lt;int&gt; TItems;
  typedef std::vector &lt; std::pair &lt;int, int&gt; &gt; TPairs;
  </code></pre>
  
  <p>Is there any way to transform all first items in pair to another vector in one step</p>
  
  <pre><code>int main ()
  {
  TItems items;
  TPairs pairs;
  
  pairs.push_back (std::make_pair(1,3));
  pairs.push_back (std::make_pair(5,7));
  
  std::transform( items.begin(), items.end(), items.begin(), comp ( &amp;pairs ) );
  
  return 0;
  }
  </code></pre>
  
  <p>How to design a functor?</p>
  
  <pre><code>class comp
  {
  private:
       TPairs *pairs;
  
  public:
      comp ( TPairs  *pairs_ ) : pairs ( pairs_) { }
  
      unsigned int operator () ( const unsigned int index ) const
      {
          return  (*pairs)[index].second != pairs-&gt;end();  //Bad idea
      }
  };
  </code></pre>
  
  <p>Maybe there is some more user friendly method without lambda expressions and loops. Thanks for your help.</p>