The std::map::value_comp() is a function in C++ STL. It returns a function object that compares objects of type std::map::value.
value_compare value_comp() const
Parameters: It does not accept any parameters.
Returns: This method returns a function object that compares objects of type std::map::value.
Time Complexity: O(1)
Below examples illustrate the map::value_comp() method:
Map contains following elements a = 1 b = 2 c = 3 d = 4 e = 5
Map contains following elements a = A b = B c = C d = D e = E
Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.
- map::at() and map::swap() in C++ STL
- Searching in a map using std::map functions in C++
- Descending order in Map and Multimap of C++ STL
- Map in C++ Standard Template Library (STL)
- Map of pairs in STL
- Traversing a map (or unordered_map) in C++ STL
- map::clear() in C++ STL
- map::size() in C++ STL
- map::begin() and end() in C++ STL
- map::empty() in C++ STL
- map::operator in C++ STL
- map::at() in C++ STL
- Default values in a Map in C++ STL
- set vs map in C++ STL
- map emplace() in C++ STL
- map cbegin() and cend() function in C++ STL
- map crbegin() and crend() function in C++ STL
- map max_size() in C++ STL
- map upper_bound() function in C++ STL
- map 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.