Q: C++) About deduplication of set #include <iostream>
#include <set>

using namespace std;

struct A
{
    int n1;
    int n2;
    
    A(int n1, int n2)
    {
        this->n1 = n1;
        this->n2 = n2;
    }
};

struct Cop {
    bool operator() (const A&a, const A&b) 
    {
        if (a.n1 > b.n1)
            return true;
        return false;
    }
};


int main(void)
{
    set<A, Cop> a;
    a.insert(A(4, 5));
    a.insert(A(4, 6));

    for (set<A>::iterator it = a.begin(); it != a.end(); ++it)
    {
        cout << it->n1 << " " << it->n2 << endl;

    }

}

result:
4 5
As you can see, even though the n2 elements of the A structure are not the same, the (4, 6) element is deleted. Can I solve this through operator overloading?
