C++ unordered_multimap - key_eq() Function
The C++ unordered_multimap::key_eq function returns the key equivalence comparison predicate used by the unordered_multimap container. The key equivalence comparison is a predicate that takes the value of two elements as arguments and returns a bool value indicating whether they are to be considered equivalent. By default, it is equal_to<key_type>, which returns the same as applying the equal-to operator (==) to the arguments.
Syntax
key_equal key_eq() const;
Parameters
No parameter is required.
Return Value
The key equality comparison object.
Time Complexity
Constant i.e, Θ(1)
Example:
The example below shows the usage of unordered_multimap::key_eq().
#include <iostream> #include <unordered_map> using namespace std; int main (){ unordered_multimap<string, string> uMMap; bool case_insensitive = uMMap.key_eq()("alpha", "Alpha"); cout<<"uMMap.key_eq() is "; cout<<(case_insensitive? "case insensitive." : "case sensitive."); return 0; }
The output of the above code will be:
uMMap.key_eq() is case sensitive.
❮ C++ <unordered_map> Library