I'd like to sort an array of pointers, however VS won't compile, saying
'testClass::compareItems': non-standard syntax; use '&' to create a pointer to member
The comparer looks like this:
bool testClass::compareItems(ElementType *a, ElementType *b)
{
return elementToProfit[a] / a->w() > elementToProfit[b] / b->w();
}
while the array is just a normal array.
for (auto &knapsack : knapsacks)
{
std::sort(knapsack.second.begin(), knapsack.second.end(), compareItems);
}
I'm not quite sure what's going on. VS is also complaining that
'void std::sort(_RanIt,_RanIt)': expects 2 arguments - 3 provided
which I assume is because there's an issue with the comparer? This should be super easy... any help is greatly apprecitated, thanks!