class Myclass{
public:
int m_a1;
int m_a2;
int m_Arry[2];
}struct MyStruct{
int x;
int y;
}CMap<MyStruct, MyStruct&, Myclass, Myclass&> app_Map;在网上查了,说是要重载2个函数,HashKey()和CompareElements()
哪位高手帮忙,说说这2个函数怎么重载?
public:
int m_a1;
int m_a2;
int m_Arry[2];
}struct MyStruct{
int x;
int y;
}CMap<MyStruct, MyStruct&, Myclass, Myclass&> app_Map;在网上查了,说是要重载2个函数,HashKey()和CompareElements()
哪位高手帮忙,说说这2个函数怎么重载?
public:
int m_a1;
int m_a2;
int m_Arry[2];
};struct MyStruct{ int x;
int y; BOOL AFXAPI operator==(const MyStruct& n) const
{
return x == n.x
&& y == n.y;
}
};
template<>
inline UINT AFXAPI HashKey(MyStruct& key)
{
return HashKey((int)key.x) + HashKey((int)key.y);
} CMap<MyStruct, MyStruct&, Myclass, Myclass&> app_Map;