title: How can I sort a vector containing pair<int,int> elements? Sorting is done as per the compare function
body: <pre><code>typedef pair&lt;int,int&gt;ii;
  vector&lt;ii&gt;vii;
  
  sort(vii.begin(),vii.end(),comp);
  
   ii comp(ii a,ii b){
     if(a.first&gt;b.first)
     return a;
     else if(a.first==b.first){
      if(a.second&gt;b.second)
      return a;
      else
      return b;
     }
     else{
      return b;
     }
   }
  </code></pre>
  
  <p>//This way it is throwing a compilation error. Can you guide how to sort this vector as per //the conditions given in the compare function.</p>