When I call my build
function from my code below, I get the following compile errors:
error C3867: 'SuffixArray::cmp': function call missing argument list; use '&SuffixArray::cmp' to create a pointer to member
error C2780: 'void std::sort(_RanIt,_RanIt)' : expects 2 arguments - 3 provided
This is my code:
class A{
private:
std::string text;
std::vector<int> array;
bool cmp(int a, int b) {
return std::lexicographical_compare(text.begin() + a, text.end(),
text.begin() + b, text.end());
}
void build(const std::string &str, std::vector<int> &vec) {
// Some vector values actions.
std::sort(vec.begin(), vec.end(), cmp);
}
};
What's wrong here? I'm using the Visual C++ compiler.