upper_bound vs. lower_bound

Is it true that there is no practical difference between std::lower_bound and std::upper_bound if the sorted range has all unique values?
Who is Participating?
upper_bound returns the first value higher than a given value in a sorted series.
lower_bound returns the first value which is not less than a given value in a sorted series


So, in other words, lower_bound is equivalent to >=, while upper_bound is equivalent to >. ie. they're not exactly the same.
No. See the code samples and the output at http://www.sgi.com/tech/stl/upper_bound.html and http://www.sgi.com/tech/stl/lower_bound.html (scroll down a bit for the examples on both pages)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.