The std::multimap::key_comp() is an inbuilt function in C++ STL which returns a copy of the comparison object used by the container.By default, this is a less object, which returns the same as operator ‘<'.It is a function pointer or a function object which takes two arguments of the same type as the container elements and returns true if the first argument is considered to go before the second in the strict weak ordering it defines or false otherwise.Two keys are considered equivalent if key_comp returns false reflexively (i.e., no matter the order in which the keys are passed as arguments).
Parameters: This function does not accept any parameter.
Return value: The function returns a copy of the comparison object used by the container.
Below examples illustrate the multimap::key_comp() method:
Multimap has the elements a => 10 b => 20 c => 30 d => 40
Multimap has the elements a => 100 b => 200 c => 300 d => 400
- multimap::crbegin() and multimap::crend() in C++ STL
- multimap::cbegin() and multimap::cend() in C++ STL
- multimap::begin() and multimap::end() in C++ STL
- multimap maxsize() in C++ STL
- multimap operator = in C++ STL
- multimap insert() in C++ STL
- multimap rbegin in C++ STL
- multimap rend in C++ STL
- multimap key_comp in C++ STL
- multimap equal_range() in C++ STL
- multimap::erase() in C++ STL
- multimap find() in C++ STL
- multimap::emplace_hint() in C++ STL
- multimap::swap() in C++ STL
- multimap::operator= in C++ STL
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.