The set::find is a built-in function in C++ STL which returns an iterator to the element which is searched in the set container. If the element is not found, then the iterator points to the position just after the last element in the set.
Parameters: The function accepts one mandatory parameter element which specifies the element to be searched in the set container.
Return Value: The function returns an iterator which points to the element which is searched in the set container. If the element is not found, then the iterator points to the position just after the last element in the set.
Below program illustrates the above function.
The set elements after 3 are: 3 4 5
- map find() function in C++ STL
- unordered_multimap find() function in C++ STL
- multiset find() function in C++ STL
- unordered_multiset find() function in C++STL
- unordered_set find() function in C++ STL
- How to call some function before main() function in C++?
- Function Overloading vs Function Overriding in C++
- Difference between Virtual function and Pure virtual function in C++
- What happens when a virtual function is called inside a non-virtual function in C++
- std::find in C++
- Find if there is a subarray with 0 sum
- string find in C++
- multimap find() in C++ STL
- unordered_map find in C++ STL
- How to find the sum of elements of an Array using STL in C++?
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.