I want to sort a vector using std::sort, but my sort method is a static method of a class, and I want to call std::sort outside it, but it seems to be trouble doing it this way.
On the class:
static int CompareIt(void *sol1, void *sol2) { ... }
std::sort call:
sort(distanceList.at(q).begin(),
distanceList.at(q).end(),
&DistanceNodeComparator::CompareIt);
Shouldn’t it be possible to do this way?
As others have mentioned, it needs a boolean return type. Here’s an example which works:
[Edit] Updated the code above to make it a little simpler. I’m not suggesting it’s nice code, but without know more about the OPs real implementation, it’s difficult to give a better example!