title: How do I sort a vector of pairs based on the second element of the pair?
body: <p>If I have a vector of pairs:</p>
  <pre><code>std::vector&lt;std::pair&lt;int, int&gt; &gt; vec;
  </code></pre>
  <p>Is there and easy way to sort the list in <strong>increasing</strong> order based on the second element of the pair?</p>
  <p>I know I can write a little function object that will do the work, but is there a way to use existing parts of the <em>STL</em> and <code>std::less</code> to do the work directly?</p>
  <p>EDIT:  I understand that I can write a separate function or class to pass to the third argument to sort.  The question is whether or not I can build it out of standard stuff.  I'd really something that looks like:</p>
  <pre><code>std::sort(vec.begin(), vec.end(), std::something_magic&lt;int, int, std::less&gt;());
  </code></pre>