[Cs3] lower_bound and upper_bound
Mikhail Nesterenko
mikhail at cs.kent.edu
Wed Jul 1 10:28:26 EDT 2015
CS3 students,
For maps, multi_maps, sets: lower_bound and upper_bound
operate as follows.
lower_bound(key) returns the iterator to the first element that is
not smaller than key. That is, it returns end() if the element
with this key is missing from container
upper_bound(key) returns the iterator to the first element that is
greater than the key. Again, returns end() if key is missing
lower_bound() and upper_bound are not defined for hashes.
Note also that there is std::lower_bound() and std:upper_bound()
algorithms that can be applied to any half-open range of iterators
and, therefore, can be used for non-associative containers such as
vectors.
Thanks,
--
Mikhail
More information about the cs3
mailing list