Unlike upper_bound, this member function returns an iterator to the element also if it compares equal to x and not only if it compares greater.
Notice that, internally, all the elements in a multiset container are always ordered following the criterion defined by its comparison object, therefore all the elements that follow the one returned by this function will also compare greater than or equal to x.
Parameters
- x
- Key value to be compared.
key_type is a member type defined in multiset containers as an alias of Key, which is the first template parameter and the type of the elements stored in the container.
Return value
An iterator to the the first element in the container which does not compare less than x.iterator is a member type, defined in multiset as a bidirectional iterator 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 |
|
Notice that lower_bound(30) returns an iterator to 30, whereas upper_bound(60) returns an iterator to 70.
mymultiset contains: 10 20 70 80 90 |
Complexity
Logarithmic in size.See also
| multiset::upper_bound | Return iterator to upper bound (public member function) |
| multiset::equal_range | Get range of equal elements (public member function) |
| multiset::find | Get iterator to element (public member function) |
| multiset::count | Count elements with a specific key (public member function) |
