Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofCD1 status.

577. upper_bound(first, last, ...) cannot return last

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 iteratori in the range[first,last) such thatfor any iteratorj in 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 iteratori in the range[first,last)] such thatfor any iteratorj in the range[first, i) the following correspondingconditions hold:!(value < *j) orcomp(value, *j) == false.


[8]ページ先頭

©2009-2026 Movatter.jp