hash_map::value_comp (STL/CLR)

Copies the ordering delegate for two element values.

    value_compare^ value_comp();

The member function returns the ordering delegate used to order the controlled sequence. You use it to compare two element values.

// cliext_hash_map_value_comp.cpp 
// compile with: /clr 
#include <cliext/hash_map> 
 
typedef cliext::hash_map<wchar_t, int> Myhash_map; 
int main() 
    { 
    Myhash_map c1; 
    Myhash_map::value_compare^ kcomp = c1.value_comp(); 
 
    System::Console::WriteLine("compare([L'a', 1], [L'a', 1]) = {0}", 
        kcomp(Myhash_map::make_value(L'a', 1), 
            Myhash_map::make_value(L'a', 1))); 
    System::Console::WriteLine("compare([L'a', 1], [L'b', 2]) = {0}", 
        kcomp(Myhash_map::make_value(L'a', 1), 
            Myhash_map::make_value(L'b', 2))); 
    System::Console::WriteLine("compare([L'b', 2], [L'a', 1]) = {0}", 
        kcomp(Myhash_map::make_value(L'b', 2), 
            Myhash_map::make_value(L'a', 1))); 
    System::Console::WriteLine(); 
    return (0); 
    } 
 
compare([L'a', 1], [L'a', 1]) = True
compare([L'a', 1], [L'b', 2]) = True
compare([L'b', 2], [L'a', 1]) = False

Header: <cliext/hash_map>

Namespace: cliext

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft