Freigeben über


hash_multimap::key_compare (STL/CLR)

 

The latest version of this topic can be found at hash_multimap::key_compare (STL/CLR).

The ordering delegate for two keys.

Syntax

Microsoft::VisualC::StlClr::BinaryDelegate<GKey, GKey, bool>  
    key_compare;  

Remarks

The type is a synonym for the delegate that determines the ordering of its key arguments.

Example

// cliext_hash_multimap_key_compare.cpp   
// compile with: /clr   
#include <cliext/hash_map>   
  
typedef cliext::hash_multimap<wchar_t, int> Myhash_multimap;   
int main()   
    {   
    Myhash_multimap c1;   
    Myhash_multimap::key_compare^ kcomp = c1.key_comp();   
  
    System::Console::WriteLine("compare(L'a', L'a') = {0}",   
        kcomp(L'a', L'a'));   
    System::Console::WriteLine("compare(L'a', L'b') = {0}",   
        kcomp(L'a', L'b'));   
    System::Console::WriteLine("compare(L'b', L'a') = {0}",   
        kcomp(L'b', L'a'));   
    System::Console::WriteLine();   
  
// test a different ordering rule   
    Myhash_multimap c2 = cliext::greater<wchar_t>();   
    kcomp = c2.key_comp();   
  
    System::Console::WriteLine("compare(L'a', L'a') = {0}",   
        kcomp(L'a', L'a'));   
    System::Console::WriteLine("compare(L'a', L'b') = {0}",   
        kcomp(L'a', L'b'));   
    System::Console::WriteLine("compare(L'b', L'a') = {0}",   
        kcomp(L'b', L'a'));   
    return (0);   
    }  
  
compare
(L'a', L'a') = True  
compare
(L'a', L'b') = True  
compare
(L'b', L'a') = False  
  
compare
(L'a', L'a') = False  
compare
(L'a', L'b') = False  
compare
(L'b', L'a') = True  

Requirements

Header: <cliext/hash_map>

Namespace: cliext

See Also

hash_multimap (STL/CLR)
hash_multimap::key_comp (STL/CLR)
hash_multimap::key_type (STL/CLR)
hash_multimap::value_compare (STL/CLR)