We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.


Calculates a hash value for the given key.

template<class ARG_KEY> 
   ARG_KEY key  


Template parameter specifying the data type used to access map keys.


The key whose hash value is to be calculated.

The key's hash value.

This function is called directly by CMap::RemoveKey and indirectly by CMap::Lookup and CMap::Operator [].

The default implementation creates a hash value by shifting key right by four positions. Override this function so that it returns hash values appropriate for your application.

template <> UINT AFXAPI HashKey(unsigned __int64 key)
   // Generate the hash value by XORing the lower 32 bits of the number  
   // with the upper 32 bits 
   return(UINT(key) ^ UINT(key >> 32));

Header: afxtempl.h