This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofCD1 status.
Section: 26.8.4.3[upper.bound]Status:CD1Submitter: Seungbeom KimOpened: 2006-05-03Last modified: 2016-01-28
Priority:Not Prioritized
View all issues withCD1 status.
Discussion:
ISO/IEC 14882:2003 says:
25.3.3.2 upper_bound
Returns: The furthermost iterator
iin the range[first,last)such thatfor any iteratorjin the range[first, i)the following correspondingconditions hold:!(value < *j)orcomp(value, *j) == false.
From the description above, upper_bound cannot return last, since it'snot in the interval [first, last). This seems to be a typo, because ifvalue is greater than or equal to any other values in the range, or ifthe range is empty, returning last seems to be the intended behaviour.The corresponding interval for lower_bound is also [first, last].
Proposed resolution:
Change [lib.upper.bound]:
Returns: The furthermost iterator
iin the range[first,lastsuch thatfor any iterator)]jin the range[first, i)the following correspondingconditions hold:!(value < *j)orcomp(value, *j) == false.