equal_range finds the range of elements equivalent to a value by returning an std::pair containing lower and upper iterators. The lower iterator points to the first element not less than the value; the upper iterator points to the first element greater than it. section 7.2.2 section 7.2.3
Use the returned bounds to:
- Detect absence: matching bounds indicate that no equivalent element is present. section 7.2.2
- Walk every value belonging to a key in an std::multimap. section 7.2.3
- Replace separate lower_bound and upper_bound calls when searching associative containers. section 7.2.2
Finding overlapping dictionary words
A dictionary lookup can call dictionary.equal_range(stem), then check that the lower iterator is not at the end and that its key begins with the stem. The function returns the first matching word and its offset.
