I am trying to use custom sort inside a class,
such as sort(arr,arr+n,cust);
inside a class function.
Custom sort looks like this:
bool cust (int a, int b) {
return pos[a]<pos[b];
}
Where pos
is an array inside class.
But it does not compile, and gives compilation error
"invalid use of non-static member function" how to get rid of compilation error.
my code -> https://pastebin.com/W1zw0A5s
I have tried writing:
static bool cust (int a, int b) {
/* same code */
}
which hasn't helped.