#include <iostream>
#include <set>
struct Point
{
Point(double x, double y)
: x(x)
, y(y)
{
}
friend bool operator < (const Point& lhs, const Point& rhs);
friend bool operator == (const Point& lhs, const Point& rhs);
double x;
double y;
};
bool operator < (const Point& lhs, const Point& rhs)
{
return lhs.x < rhs.x;
}
bool operator == (const Point& lhs, const Point& rhs)
{
return lhs.x == rhs.x && lhs.y == rhs.y;
}
int main()
{
std::set<Point> points = { Point(42.0, 50.0), Point(1.0, 2.0), Point(42.0, 50.0) };
for (const auto& p : points)
{
std::cout << p.x << ", " << p.y << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c2V0PgoKc3RydWN0IFBvaW50CnsKCVBvaW50KGRvdWJsZSB4LCBkb3VibGUgeSkKCTogeCh4KQoJLCB5KHkpCgl7CgkJCgl9CgkKCWZyaWVuZCBib29sIG9wZXJhdG9yIDwgKGNvbnN0IFBvaW50JiBsaHMsIGNvbnN0IFBvaW50JiByaHMpOwoJZnJpZW5kIGJvb2wgb3BlcmF0b3IgPT0gKGNvbnN0IFBvaW50JiBsaHMsIGNvbnN0IFBvaW50JiByaHMpOwoJCglkb3VibGUgeDsKCWRvdWJsZSB5Owp9OwoKYm9vbCBvcGVyYXRvciA8IChjb25zdCBQb2ludCYgbGhzLCBjb25zdCBQb2ludCYgcmhzKQp7CglyZXR1cm4gbGhzLnggPCByaHMueDsKfQoKYm9vbCBvcGVyYXRvciA9PSAoY29uc3QgUG9pbnQmIGxocywgY29uc3QgUG9pbnQmIHJocykKewoJcmV0dXJuIGxocy54ID09IHJocy54ICYmIGxocy55ID09IHJocy55Owp9CgppbnQgbWFpbigpIAp7CglzdGQ6OnNldDxQb2ludD4gcG9pbnRzID0geyBQb2ludCg0Mi4wLCA1MC4wKSwgUG9pbnQoMS4wLCAyLjApLCBQb2ludCg0Mi4wLCA1MC4wKSB9OwoJCglmb3IgKGNvbnN0IGF1dG8mIHAgOiBwb2ludHMpCgl7CgkJc3RkOjpjb3V0IDw8IHAueCA8PCAiLCAiIDw8IHAueSA8PCBzdGQ6OmVuZGw7CQoJfQoJCglyZXR1cm4gMDsKfQ==