Condividi tramite


HashKey

Calcola un valore hash per la chiave specificata.

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

Parametri

  • ARG_KEY
    Parametro di modello che specifica il tipo di dati utilizzato per accedere alle chiavi della mappa.

  • key
    La chiave del cui valore hash deve essere calcolato.

Valore restituito

Il valore hash della chiave.

Note

Questa funzione viene chiamata direttamente da CMap::RemoveKey e indirettamente da CMap::Lookup e da CMap::Operator [].

l'implementazione predefinita crea un valore hash scorrendo la destra di key da quattro posizioni.Eseguire l'override della funzione in modo che restituisca i valori hash appropriati per l'applicazione.

Esempio

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));
}

Requisiti

Header: afxtempl.h

Vedere anche

Riferimenti

Classe CMap

Concetti

Macro MFC e Globals