lower_bound problem
std::lower_bound doesn't check for a specific element, it returns the first position whose value is greater than or equal to the specified value.
Quote:Source: SGI
Description
Lower_bound is a version of binary search: it attempts to find the element value in an ordered range [first, last) [1]. Specifically, it returns the first position where value could be inserted without violating the ordering. [2] The first version of lower_bound uses operator< for comparison, and the second uses the function object comp.
The first version of lower_bound returns the furthermost iterator i in [first, last) such that, for every iterator j in [first, i), *j < value.
The second version of lower_bound returns the furthermost iterator i in [first, last) such that, for every iterator j in [first, i), comp(*j, value) is true.
Emphasis added.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement