C++ set find() Function
C++ set find() Function with tutorial for beginners and professionals with examples on constructor, destructor, operator=(), begin(), cbegin(), cend(), end(), crbegin(), empty(), max_size(), clear(), emplace_hint(), key_comp(), swap() etc.
Related Links:
- C++ set key_comp() Function
- C++ set value_comp() Function
- C++ set find() Function
- C++ set count() Function
- C++ set lower_bound() Function
- C++ set upper_bound() Function
- C++ set equal_range() Function
- C++ set get_allocator() Function
- C++ algorithm iter_swap() function
- C++ multiset equal_range() function
- C++ Program to Convert Number in Character
- C++ Program to Print Alphabet Triangle
- C++ Vector back() function
- C++ Program to Print Number Triangle
- C++ algorithm search() function
- C++ Program to Generate Fibonacci Triangle
- Top 39 C++ Interview Questions (2021)
- C++ multiset lower_bound() function
- C++ multiset upper_bound() function
- C++ multiset get_allocator() function
- C++ algorithm adjacent_find() function
- C++ algorithm any_of() function
- C++ multiset swap() function
- C++ algorithm copy() function
- C++ algorithm remove_if() function
- C++ algorithm reverse_copy() function
- C++ algorithm copy_if() function
- C++ Math llrint() Function
- C++ Math tgamma() Function
- C++ Math lgamma() Function
- C++ Math nearbyint() Function
- C++ Math remainder() Function
- C++ Math remquo() Function
- C++ Math fabs() Functions
- C++ Math abs() Functions
- C++ Math fma() Function
- C++ Math fpclassify() Function
- C++ Math isgreaterequal() Function
- C++ algorithm count() function
- C++ algorithm count_if() function
- C++ algorithm equal() function
- C++ algorithm find_if() function
- C++ algorithm all_of() function
- C++ algorithm copy_backward() function
- C++ algorithm copy_n() function
- C++ algorithm is_permutation() function
- C++ algorithm mismatch() function
- C++ algorithm none_of() function
- C++ algorithm swap() function
- C++ algorithm fill() function
- C++ algorithm replace_copy_if() function
- C++ algorithm replace_copy() function
- C++ algorithm replace_if() function
- C++ algorithm transform() function
- C++ algorithm fill_n() function
- C++ set crend() Function
- C++ set empty() Function
- C++ set size() Function
- C++ set max_size() Function
- C++ Output Iterator
- C++ Programs
- C++ algorithm move_backward() function
- C++ algorithm reverse() function
- C++ algorithm find_if_not() function
- C++ Math isfinite() Function
- C++ Math isinf() Function
- C++ multiset operator less than
- C++ multiset non member operator greater than
- C++ Math isnan() Functions
- C++ Math isnormal() Function
- C++ Math signbit() Function
- C++ Math isgreater() Function
- C++ Math less() Function
- C++ Math isunordered() Function
- C++ Math erf() Function
- C++ Math erfc() Function
- C++ set cbegin() Function
- C++ set end() Function
- C++ String rbegin() function
- C++ algorithm random_shuffle() function
- C++ algorithm remove_copy_if() function
- C++ Vector front() function
- C++ set
- C++ Stack
- C++ Queue
- C++ Stack empty() Function
- C++ Stack pop() Function
- C++ Queue emplace() Function
- C++ Queue empty() Function
- C++ Queue front() Function
- C++ algorithm is_sorted_until() function
- C++ algorithm is_sorted() function
- C++ algorithm rotate_copy() function
- C++ algorithm rotate() function
- C++ Stack push() Function
- C++ Stack size() Function
- C++ set swap() Function
- C++ set clear() Function
- C++ set emplace() Function
- C++ set emplace_hint() Function
- C++ algorithm merge() function
- C++ algorithm set_union() function
- C++ Queue pop() Function
- C++ Math cos() Function
- C++ Queue push() Function
- C++ set insert() Function
- C++ set erase() Function
- C++ algorithm find() function
- C++ Math sin() Function
- C++ Queue size() Function
- C++ multiset
- C++ Math tan() Function
- C++ Math log10() Function
- C++ String compare() function
- C++ Math acos() Function
- C++ String length() function
- C++ Math asin() Function
- C++ String swap() function
- C++ multiset constructor
- C++ Math atan() Functions
- C++ String size() function
- C++ set operator less than
- C++ set operator greater than
- C++ Math atan2() Function
- C++ String resize() function
- C++ String replace() function
- C++ multiset clear() function
- C++ multiset emplace() function
- C++ multiset erase() function
- C++ multiset destructor
- C++ multiset begin() function
- C++ multiset end() function
- C++ multiset operator= function
- C++ multiset rbegin() function
- C++ multiset crbegin() function
- C++ algorithm partial_sort() function
- C++ algorithm sort() function
- C++ multiset swap() function
- C++ multiset rend() function
- C++ multiset cbegin() function
- C++ multiset cend() function
- C++ multiset emplace_hint() function
- C++ multiset find() function
- C++ History
- C++ Features
- C++ set swap() Function (Non-member)
- C++ String max_size() function
- Turbo C++ — Download and Installation
- C++ Program
- C++ Basic Input Output (cin, cout, endl)
- C++ Variable
- C++ Object Class
- C++ Vector rbegin() function
- C++ Data types
- C++ Keywords
- C++ Vector clear() function
- C++ Vector max_size() function
- C++ Operators
- C++ if-else
- C++ switch
- C++ For Loop
- C++ While Loop
- C++ Math cosh() Function
- C++ Do-While Loop
- C++ Math sinh() Function
- C++ Break Statement
- C++ Math tanh() Function
- C++ Continue Statement
- C++ Math acosh() Function
- C++ Goto Statement
- C++ Math asinh() Function
- C++ Math atanh() Function
- C++ Comments
- C++ Math exp() Function
- C++ Math frexp() Function
- C++ Math log() Function
- C++ Functions
- C++ Math modf() Function
- C++ Recursion
- C++ Storage Classes
- C++ Forward Iterator
- C++ Input Iterator
- C++ Math exp2() Function
- C++ multiset key_comp() function
- C++ algorithm unique_copy() function
- C++ Math llround() Function
- C++ Arrays
- C++ Passing Array to Function
- C++ Multidimensional Arrays
- C++ Pointers
- C++ OOPs Concepts
- C++ Constructor
- C++ Copy Constructor
- C++ Destructor
- C++ algorithm upper_bound() function
- C++ this Pointer
- C++ static
- C++ Structs
- C++ Enumeration
- C++ friend function
- C++ Math Functions
- C++ Inheritance
- C++ Aggregation
- C++ Polymorphism
- C++ Overloading
- C++ algorithm lower_bound() function
- C++ Vector
- C++ Math expm1() Function
- C++ Math log1p() Function
- C++ Math log2() Function
- C++ String append() function
- C++ Tutorial | Learn C++ Programming
- C++ multiset crend() function
- C++ multiset empty() function
- C++ multiset insert() function
- C++ Math logb() Function
- C++ String at() function
- C++ Math scalbn() Function
- C++ String find() function
- C++ Math scalbln() Function
- C++ String find_first_of() function
- C++ algorithm replace() function
- C++ algorithm swap_ranges() function
- C++ Math ilogb() Function
- C++ String find_first_not_of() function
- C++ Math copysign() Function
- C++ String find_last_of() function
- C++ Math nextafter() Function
- C++ String find_last_not_of() function
- C++ Math nexttoward() Function
- C++ String insert() function
- C++ String push_back() function
- C++ String assign() function
- C++ algorithm search_n() function
- C++ algorithm generate_n() function
- C++ String copy() function
- C++ algorithm find_end() function
- C++ algorithm find_first_of() function
- C++ algorithm generate() function
- C++ algorithm remove() function
- C++ algorithm is_partitioned() function
- C++ String begin() function
- C++ String cbegin() function
- C++ String cend() function
- C++ String clear() function
- C++ String crbegin() function
- C++ Function Overriding
- C++ virtual function
- C++ vs C#
- C++ Convert int to string
- C++ Components of STL
- C++ String Data() function
- C++ String empty() function
- C++ Algorithm
- C++ Iterators
- C++ Bidirectional Iterator
- C++ Namespaces
- C++ Strings
- C++ String erase() function
- C++ Stack emplace() Function
- C++ Exception Handling
- C++ String front() function
- C++ vs Java
- C++ try-catch
- C++ String operator+=() function
- C++ multiset value_comp() function
- C++ multiset count() function
- C++ User-Defined Exceptions
- C++ Templates
- C++ Signal Handling
- C++ File and Stream
- C++ String operator=() function
- C++ String operator[]() function
- C++ String rfind() function
- C++ String end() function
- C++ String capacity() function
- C++ String shrink_to_fit() function
- C++ String crend() function
- C++ algorithm shuffle() function
- C++ algorithm stable_partition() function
- C++ String reserve() function
- C++ String pop_back() function
- C++ Vector at() function
- C++ String c_str() function
- C++ Vector swap() function
- C++ Vector push_back() function
- C++ Vector pop_back() function
- C++ Vector empty() function
- C++ set destructor
- C++ set operator=() Function
- C++ set begin() Function
- C++ Vector insert() function
- C++ Stack top() Function
- C++ Queue back() Function
- C++ Vector erase() function
- C++ String back() function
- C++ String rend() function
- C++ Vector resize() function
- C++ Vector size() function
- C++ Vector capacity() function
- C++ Math islessgreater() Function
- C++ Vector assign() function
- C++ Vector operator=() function
- C++ Vector operator[]() function
- C++ Vector end() function
- C++ Vector emplace() function
- C++ Vector emplace_back() function
- C++ Vector rend() function
- C++ Vector begin() function
- C++ Vector cend() function
- C++ Vector cbegin() function
- C++ Math fdim() Function
- C++ Vector crbegin() function
- C++ Math fmax() Function
- C++ Vector crend() function
- C++ Math fmin() Function
- C++ Vector data() function
- C++ Vector shrink_to_fit() function
- C++ Math pow() Function
- C++ algorithm unique() function
- C++ Math sqrt() Function
- C++ Math cbrt() Function
- C++ Math islessequal() Function
- C++ Math hypot() Function
- C++ Math ceil() Functions
- C++ algorithm for_each() function
- C++ multiset max_size() function
- C++ multiset size() function
- C++ Math floor() Function
- C++ set constructor
- C++ Math round() Function
- C++ algorithm equal_range() function
- C++ algorithm includes() function
- C++ algorithm inplace_merge() function
- C++ Math lround() Functions
- C++ algorithm partition_copy() function
- C++ algorithm partition_point() function
- C++ algorithm partition() function
- C++ Math fmod() Function
- C++ Program to Reverse Number
- C++ Math trunc() Function
- C++ Program to Swap Tow Number Without Third Variable
- C++ algorithm stable_sort() function
- C++ algorithm binary_search() function
- C++ Math rint() Function
- C++ Program to Convert Decimal to Binary
- C++ Math lrint() Function
- C++ algorithm nth_element() function
- C++ algorithm partial_sort_copy() function
- C++ set cend() Function
- C++ set rbegin() Function
- C++ set rend() Function
- C++ set crbegin() Function
- C++ algorithm move() function
- C++ algorithm remove_copy() function
.Net
Java
Related Links
© 2023 — TheDeveloperBlog.com | Visit CSharpDotNet.com for more C# Dot Net Articles
std:: set::find
Searches the container for an element equivalent to val and returns an iterator to it if found, otherwise it returns an iterator to set::end.
Two elements of a set are considered equivalent if the container’s comparison object returns false reflexively (i.e., no matter the order in which the elements are passed as arguments).
Parameters
val Value to be searched for.
Member type value_type is the type of the elements in the container, defined in set as an alias of its first template parameter (T).
Return value
An iterator to the element, if val is found, or set::end otherwise.
Member types iterator and const_iterator are bidirectional iterator types pointing to elements.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// set::find int main () < std::setint> myset; std::setint>::iterator it; // set some initial values: for (int i=1; i// set: 10 20 30 40 50 it=myset.find(20); myset.erase (it); myset.erase (myset.find(40)); std::cout "myset contains:"; for (it=myset.begin(); it!=myset.end(); ++it) std::cout ' ' << *it; std::cout '\n'; return 0; >
Complexity
Iterator validity
Data races
The container is accessed (neither the const nor the non-const versions modify the container).
Concurrently accessing the elements of a set is safe.
Exception safety
See also
set::count Count elements with a specific value (public member function) set::lower_bound Return iterator to lower bound (public member function) set::upper_bound Return iterator to upper bound (public member function)