The function object you pass to std::partial_sort
needs to be either a callable object, or a function pointer. To make a function pointer you nedd to use the address-of operator &
, just like when you make a pointer out of any other variable:
partial_sort(..., &featuresDistComp);
// ^
// |
// Note address-of operator here
Also, I hope your function is marked as static
? You can't use non-static member functions as ordinary function pointers. The reason is that all non-static member functions have a hidden first arguments that is the this
pointer inside the function. So either make sure the function is static
or use e.g. std::bind
:
using namespace std::placeholders; // for _1, _2, _3...
partial_sort(..., std::bind(&ScalableSummary::featuresDistComp, this, _1, _2));