Parameters
- x
- Key value to be searched for.
key_type is a member type defined in map containers as an alias of Key, which is the first template parameter and the type of the keys for 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 25 |
|
Output:
a is an element of mymap. b is not an element of mymap. c is an element of mymap. d is not an element of mymap. e is not an element of mymap. f is an element of mymap. g is not an element of mymap. |
Complexity
Logarithmic in size.See also
| map::find | Get iterator to element (public member function) |
| map::size | Return container size (public member function) |
| map::equal_range | Get range of equal elements (public member function) |
