共用方式為


hash_map::hash_delegate (STL/CLR)

Finds an element that matches a specified key.

hasher^ hash_delegate();

Remarks

The member function returns the delegate used to convert a key value to an integer. You use it to hash a key.

Example

// cliext_hash_map_hash_delegate.cpp 
// compile with: /clr 
#include <cliext/hash_map> 
 
typedef cliext::hash_map<wchar_t, int> Myhash_map; 
int main() 
    { 
    Myhash_map c1; 
    Myhash_map::hasher^ myhash = c1.hash_delegate(); 
 
    System::Console::WriteLine("hash(L'a') = {0}", myhash(L'a')); 
    System::Console::WriteLine("hash(L'b') = {0}", myhash(L'b')); 
    return (0); 
    } 
 
hash(L'a') = 1616896120
hash(L'b') = 570892832

Requirements

Header: <cliext/hash_map>

Namespace: cliext

See Also

Concepts

hash_map (STL/CLR)

hash_map::hasher (STL/CLR)