C++ std list sort with custom comparator that depends on an member variable for the object instance
问题 Class: Class: private: ... vector<string> words; vector< list<int> > vints; public: myFunction(...) I am calling a sort on non-empty list in another member function: void myClass::myFunction (...) { ... if (!vints[i].empty()) vints[i].sort(sortFunc); ... } My sorting function: bool myClass::sortFunc(const int& i, const int& j) { return (words[i] < words[j]); } The Error: error: no matching function for call to ‘std::list<int, std::allocator<int> >::sort(<unresolved overloaded function type>)’