Parameters
- x
- Value to be searched for.
key_type is a member type defined in set containers as an alias of Key, which is the first template parameter and the type of the elements stored in the container.
Return value
1 if an element with a key equivalent to x is found, or zero otherwise.Member type size_type is an unsigned integral type.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
Output:
0 is not an element of myset. 1 is not an element of myset. 2 is not an element of myset. 3 is an element of myset. 4 is not an element of myset. 5 is not an element of myset. 6 is an element of myset. 7 is not an element of myset. 8 is not an element of myset. 9 is an element of myset. |
Complexity
Logarithmic in size.See also
| set::find | Get iterator to element (public member function) |
| set::size | Return container size (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) |
