The set::value_comp() is an inbuilt function in cpp that returns a copy of the comparison object used by the container. This object determines the order of the elements in the container. It is a function pointer or a function object that 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, and false otherwise. Two elements of a set are considered equivalent if value_comp returns false reflexively (i.e., no matter the order in which the elements 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 program illustrates the above function.
Set a has the numbers 0 1 2 3 4 5 6 7 8 9
- How to call some function before main() function in C++?
- Function Overloading vs Function Overriding in C++
- What happens when a virtual function is called inside a non-virtual function in C++
- Difference between Virtual function and Pure virtual function in C++
- div() function in C++
- exp() function C++
- log() function in C++
- fma() function in C++
- mbrlen() function in C/C++
- array at() function in C++ STL
- iswspace() function in C/C++
- array get() function in C++ STL
- towlower() function in C/C++
- iswxdigit() function in C/C++
- unordered_map end( ) function 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.