#include <unordered_set>
#include <iostream>

struct Point {
    int X, Y;

    Point() : X(0), Y(0) {};
    Point(const int x, const int y) : X(x), Y(y) {};
};

int main() {
    auto hash = [](const Point& p) { return std::hash<int>()(p.X) * 31 + std::hash<int>()(p.Y); };
    auto equal = [](const Point& p1, const Point& p2) { return p1.X == p2.X && p1.Y == p2.Y; };
    std::unordered_set<Point, decltype(hash), decltype(equal)> mySet(8, hash, equal);

    Point a, b(1, 2), c(b), d(3, 4);

    mySet.emplace(a);
    mySet.emplace(b);
    mySet.emplace(c);  // Insertion fails; element already exists.
    c = d;
    mySet.emplace(c);
    mySet.emplace(1, 1);
    
    for (auto const& pt : mySet) {
        std::cout << "(" << pt.X << ", " << pt.Y << ")" << std::endl;
    }

	return 0;
}