This is the part of Standard Template Library(STL) of C++. To use this STL, use Namespace: std and include “map” header file in the program.
It returns the function object or comparison object or ordering delegate that compares the keys, which is a copy of this container’s constructor argument.
It is a function pointer or an object that takes two arguments of the same type as the element keys and determines the order of the elements in the container.
Here key_compare is the type of the comparison object, which is associated to the container.
It does not accept any parameter.
It returns the key comparison function object or ordering delegate, which is defined in multimap as an alias of its third template parameter.
Below is an example of multimap::key_comp:
a = 10 b = 20 b = 30 c = 40
- multimap::cbegin() and multimap::cend() in C++ STL
- multimap::crbegin() and multimap::crend() in C++ STL
- multimap::begin() and multimap::end() in C++ STL
- multimap equal_range() in C++ STL
- multimap rend in C++ STL
- multimap operator = in C++ STL
- multimap maxsize() in C++ STL
- multimap insert() in C++ STL
- multimap key_comp() in C++ STL
- multimap rbegin in C++ STL
- multimap::operator= in C++ STL
- multimap::count() in C++ STL
- multimap::emplace() in C++ STL
- multimap::erase() in C++ STL
- multimap find() 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 email@example.com. 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.