error: reference to non-static member function must be called
<p>On compiling, I am receiving this </p>

<pre><code>error: reference to non-static member function must be called
                        std::sort(sortedCOPG_.begin(),sortedCOPG_.end(),comp_copgNode); 
</code></pre>

<p>Can someone let me as what I am doing wrong? I tried almost the same code without the classes, but there the code didnt had issues. Its only after I encapsulated the code in a class. I have removed a lot code before posting here, to keep things simple. I tried other similar posts, but couldn't make sense out of it.</p>

<pre><code>#include &lt;fstream&gt;
#include &lt;set&gt;
#include &lt;unordered_map&gt;

class Computation {
    public:

         Computation() {

        }

    private:

        struct copgNode_ {
            double weight;
            int source;
            int target;
        };


        template &lt;typename Iter&gt;
        void mst_score__( Iter first, Iter last) {
            Iter current = first;
            for (; current != last; ++current) {
                for (int i=0; i &lt; n_; ++i) {
                    if (adjMatrix_[*current][i] != 0 ) sortedCOPG_.push_back(copgNode_{adjMatrix_[*current][i],*current,i});
                }
            }
            //Here, is the line causing errors---
            std::sort(sortedCOPG_.begin(),sortedCOPG_.end(),comp_copgNode);
        }

        void m_init_computation__() {

            std::vector&lt;int&gt; mst_test_vec{0,3,7};
            mst_score__(mst_test_vec.begin(),mst_test_vec.end());

    }


        bool comp_copgNode ( const copgNode_&amp; left, const copgNode_&amp; right) {return left.weight &lt; right.weight;}    
};          
</code></pre>