I am trying to insert a object Point2D into a Point2D set but i am not able to do it, it seems the set works for int and char but not for objects.
I need help to know how to insert objects into the set ??? Assuming i want to sort them by ascending order of x value
class Point2D
{
public:
Point2D(int,int);
int getX();
int getY();
void setX(int);
void setY(int);
double getScalarValue();
protected:
int x;
int y;
double distFrOrigin;
void setDistFrOrigin();
};
int main()
{
Point2D abc(2,3);
set<Point2D> P2D;
P2D.insert(abc); // i am getting error here, i don't know why
}
operator<forPoint2Doperator<or a user specified predicate.