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 } it doesn't help;
Aucun commentaire:
Enregistrer un commentaire