title: Getting the Error "reference to non-static member function must be called "
body: <p>I am solving a problem on LeetCode to make a pair sort and give the output basically
  link - <a href="https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/" rel="nofollow noreferrer">https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/</a></p>
  <p>this is my code</p>
  <pre><code>class Solution {
      public:
      
      bool sortbysec(const pair&lt;int,int&gt; &amp;a,
                const pair&lt;int,int&gt; &amp;b)
      {
          if(a.first == b.first)
              return (a.second &lt; b.second);
          
          return (a.first &gt; b.first);
      }
      
      vector&lt;int&gt; kWeakestRows(vector&lt;vector&lt;int&gt;&gt;&amp; mat, int k) {
          
                 
          vector&lt;pair&lt;int,int&gt;&gt;zeros;
          
          vector&lt;int&gt;res;
          
          for(int i = 0;i&lt;mat.size();i++){
              zeros.push_back(make_pair(count(mat[i].begin(),mat[i].end(),0),i)) ;
          }
          sort(zeros.begin(),zeros.end(),sortbysec);
          int n = zeros.size();
          for(int i = 0;i&lt;mat.size();++i){
              res.push_back(zeros[i].second);
          }
          return res;
      }
  };
  </code></pre>
  <p>i get this error 1st time and don't know about it
  what to do to solve it</p>