title: Sorting a vector of pairs
body: <p>I have a question about sorting a vector of pairs:</p>
  
  <pre><code>std::vector&lt;std::pair&lt;double,Processor*&gt;&gt; baryProc;
  </code></pre>
  
  <p>this vector is already filled up with the pairs.
  Now I wanted to sort the pairs inside the vector based on the double value inside the pair</p>
  
  <p>EXAMPLE:</p>
  
  <p>suppose I have 3 pairs inside the vector. pair1 is at front and pair 3 is at end. pair2 is in the middle:</p>
  
  <pre><code>pair1(1, proc1) 
  pair2(3, proc2)
  pair3(2.5, proc3)
  </code></pre>
  
  <p>now i want to sort the pairs based on the double value. So that the order inside the vector is:</p>
  
  <pre><code>pair1(1, proc1) 
  pair3(2.5, proc3)
  pair2(3, proc2)
  </code></pre>
  
  <p>How could I do this? I am quite stuck.</p>