#include <iostream>
#include <vector>
#include <algorithm>
struct Point
{
Point(double x, double y)
: x(x)
, y(y)
{
}
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 && lhs.y == rhs.y;
}
int main()
{
std::vector<Point> points = { Point(42.0, 50.0), Point(1.0, 2.0), Point(42.0, 50.0) };
std::sort(points.begin(), points.end(), [](const Point& lhs, const Point& rhs)
{
return lhs.x < rhs.x;
});
points.erase(std::unique(points.begin(), points.end()), points.end());
for (const auto& p : points)
{
std::cout << p.x << ", " << p.y << std::endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKc3RydWN0IFBvaW50CnsKCVBvaW50KGRvdWJsZSB4LCBkb3VibGUgeSkKCTogeCh4KQoJLCB5KHkpCgl7CgkJCgl9CgkKCWZyaWVuZCBib29sIG9wZXJhdG9yID09IChjb25zdCBQb2ludCYgbGhzLCBjb25zdCBQb2ludCYgcmhzKTsKCQoJZG91YmxlIHg7Cglkb3VibGUgeTsKfTsKCmJvb2wgb3BlcmF0b3IgPT0gKGNvbnN0IFBvaW50JiBsaHMsIGNvbnN0IFBvaW50JiByaHMpCnsKCXJldHVybiBsaHMueCA9PSByaHMueCAmJiBsaHMueSA9PSByaHMueTsKfQoKCmludCBtYWluKCkgCnsKCXN0ZDo6dmVjdG9yPFBvaW50PiBwb2ludHMgPSB7IFBvaW50KDQyLjAsIDUwLjApLCBQb2ludCgxLjAsIDIuMCksIFBvaW50KDQyLjAsIDUwLjApIH07CglzdGQ6OnNvcnQocG9pbnRzLmJlZ2luKCksIHBvaW50cy5lbmQoKSwgW10oY29uc3QgUG9pbnQmIGxocywgY29uc3QgUG9pbnQmIHJocykKCXsKCQlyZXR1cm4gbGhzLnggPCByaHMueDsKCX0pOwoJCglwb2ludHMuZXJhc2Uoc3RkOjp1bmlxdWUocG9pbnRzLmJlZ2luKCksIHBvaW50cy5lbmQoKSksIHBvaW50cy5lbmQoKSk7CgkKCWZvciAoY29uc3QgYXV0byYgcCA6IHBvaW50cykKCXsKCQlzdGQ6OmNvdXQgPDwgcC54IDw8ICIsICIgPDwgcC55IDw8IHN0ZDo6ZW5kbDsKCX0KfQ==