Tag: hashtree

使用自定义类types作为键的C ++ unordered_map

我正在尝试使用自定义类作为unordered_map的关键字,如下所示, #include <iostream> #include <algorithm> #include <unordered_map> //#include <map> using namespace std; class node; class Solution; class Node { public: int a; int b; int c; Node(){} Node(vector<int> v) { sort(v.begin(), v.end()); a = v[0]; b = v[1]; c = v[2]; } bool operator==(Node i) { if ( ia==this->a && ib==this->b &&i.c==this->c ) { return […]