Home > Back-end >  Why compile but c hash_map use?
Why compile but c hash_map use?

Time:01-02


 
# include & lt; Hash_map & gt;
# include & lt; Cstdio>
# include & lt; Iostream>

using namespace std;
Using the namespace __gnu_cxx;

Const int NODE_HASH=13333331;
Struct Node {
int a, b;
};
Struct Node_hash {
Size_t operator () (const Node& RHS) const {
Return RHS. A * RHS. B % NODE_HASH;
}
};
///the return value type size_t for
Struct Node_equal {
Boolean operator () (const Node & amp; X, const Node & amp; Y) const {
Return x.a==y.a & amp; & X.b==y.b;
}
};

Int main ()
{
Hash_map & lt; The Node, int, Node_hash, Node_equal & gt; HMP;
return 0;
}
  • Related