다음을 통해 공유


HashKey

Calculates a hash value for the given key.

template<class ARG_KEY> 
AFX_INLINE UINT AFXAPI HashKey( 
   ARG_KEY key  
);

매개 변수

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

  • key
    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

참고 항목

참조

CMap 클래스

개념

MFC 매크로 및 전역