score:1

Accepted answer

your compare() function is a non-static member function which requires three parameters: in addition to the entities you want to compare it also requires the object which is pointed to by this. the trivial fix is to make the member static or turn it into a non-member function entirely.

however, you are better off using a comparator object with an inline function call operator if your objective is to obtain good performance: the call through a function pointer can generally not be inlined while an inline function call operator is trivial to inline.


Related Query

More Query from same tag