#include <set> struct A { int i; int j; bool operator<(A const &ref)const { return i < ref.i; } bool operator==(A const &ref)const { return i == ref.i && j == ref.j; } }; int main() { A val1 = {1, 2}; A val2 = {2, 2}; std::set<A> my_set; my_set.insert(val1); my_set.insert(val2); }
时间: 2024-12-19 01:31:15