title: error while compiling line my comparator function i have written
body: <p>The comparator i have used  shows me the error:</p>
  <pre class="lang-none prettyprint-override"><code>&lt;source&gt;: In member function 'std::vector&lt;std::pair&lt;int, int&gt; &gt; Solution::allPairs(int*, int*, int, int, int)':
  &lt;source&gt;:38:47: error: invalid use of non-static member function 'bool Solution::sortcol(const std::pair&lt;int, int&gt;&amp;, const std::pair&lt;int, int&gt;&amp;)'
     38 |                 sort(temp.begin(), temp.end(),sortcol);
        |                                               ^~~~~~~
  &lt;source&gt;:7:18: note: declared here
      7 |             bool sortcol(const pair&lt;int,int&gt; &amp;v1,const pair&lt;int,int&gt; &amp;v2)
        |                  ^~~~~~~
  </code></pre>
  <p>please correct this small code of comparator:</p>
  <pre><code>#include &lt;bits/stdc++.h&gt;
  using namespace std;
  class Solution{
      
      public:
     // pair&lt;int,int&gt;
      bool sortcol(const pair&lt;int,int&gt; &amp;v1,const pair&lt;int,int&gt; &amp;v2)
      {
          if(v1.first&lt;=v2.first)
          return true;
          else
          return false;
      }
      
      vector&lt;pair&lt;int,int&gt;&gt; allPairs(int A[], int B[], int N, int M, int X)
      {
          // Your code goes here   
          vector&lt;pair&lt;int,int&gt;&gt;temp;
        std:: pair&lt;int,int&gt;make_pair;
          
          std::set&lt;int&gt;s(A,A+N);
          
          //now traverse the second array and ,ake piar and push it back:
          
          for(int i=0;i&lt;M;i++)
          {
              int key=X-B[i];
              if(s.find(key)!=s.end())
              {
                          
                  make_pair.first=key;
                  make_pair.second=B[i];
                  temp.push_back(make_pair);
                  
                  
              }
          }
          sort(temp.begin(), temp.end(),sortcol);
           
          return temp;
          
      
      }
  };
  </code></pre>
  <p>The error comes where I have written my comparator function i don't know why</p>