Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

unordered_map::key_eq

Gets the stored comparison function object.

Pred key_eq() const;

The member function returns the stored comparison function object.

 

// std_tr1__unordered_map__unordered_map_key_eq.cpp 
// compile with: /EHsc 
#include <unordered_map> 
#include <iostream> 
 
typedef std::unordered_map<char, int> Mymap; 
int main() 
    { 
    Mymap c1; 
 
    Mymap::key_equal cmpfn = c1.key_eq(); 
    std::cout << "cmpfn('a', 'a') == " 
        << std::boolalpha << cmpfn('a', 'a') << std::endl; 
    std::cout << "cmpfn('a', 'b') == " 
        << std::boolalpha << cmpfn('a', 'b') << std::endl; 
 
    return (0); 
    } 
 
cmpfn('a', 'a') == true
cmpfn('a', 'b') == false

Header: <unordered_map>

Namespace: std

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.