I have the class which has list of pointers to objects which is needed to be sorted with comparator which is the member of this class:
class VoronoiDiagram
{
public:
void BuildVoronoi();
private:
list<shared_ptr<QPointF>> inputPoints
QPointF currentVoronoiPoint;
bool compairingPointsPredictate(shared_ptr<QPointF> a, shared_ptr<QPointF> b) { float d1 = (a->x()-currentVoronoiPoint.x())*(a->x()-currentVoronoiPoint.x()) + (a->y()-currentVoronoiPoint.y())*(a->y()-currentVoronoiPoint.y());
float d2 = (b->x()-currentVoronoiPoint.x())*(b->x()-currentVoronoiPoint.x()) + (b->y()-currentVoronoiPoint.y())*(b->y()-currentVoronoiPoint.y());
return d1 < d2; };
};
And I am calling in BuildVoronoi() this:
inputPoints.sort(compairingPointsPredictate);
But this gives to me two errors: C3867 with my comparator function and C2660 with std::list::sort (do not receive 1 argument).
Sorry for my English or for explanation. I really hope that someone here can help me out. Thanks.
this, so it doesn't match the signature required forstd::list::sort. There are plenty of duplicates out there.