//Sample Code :
// This is a sample declaration of a CMap that uses a user-defined class for as data-type for a Cmap:
#include <afxtempl.h>
class CEmployee : public CObject
{
public:
CString m_firstName;
CString m_lastName;
public:
CEmployee(){ };
// Copy constructor required by Cmap.
CEmployee(const CEmployee& n)
{
m_firstName = n.m_firstName;
m_lastName = n.m_lastName;
}
// Operator= is required by Cmap.
CEmployee& operator=(const CEmployee& n)
{
m_firstName = n.m_firstName;
m_lastName = n.m_lastName;
return *this;
}
BOOL AFXAPI operator==(const CEmployee& n) const
{
return m_firstName == n.m_firstName
&& m_lastName == n.m_lastName;
}
};
template<>
inline UINT AFXAPI HashKey(CEmployee& key)
{
return HashKey((LPCTSTR)key.m_lastName) +
HashKey((LPCTSTR)key.m_firstName);
}
// Declare the CMap object.
CMap<CEmployee, CEmployee&, CEmployee, CEmployee&> EmployeeMap;