This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofCD1 status.
binary_searchSection: 26.8.4.5[binary.search]Status:CD1Submitter: Daniel KrüglerOpened: 2007-09-08Last modified: 2016-01-28
Priority:Not Prioritized
View all issues withCD1 status.
Discussion:
In 26.8.4.5[binary.search] p. 3 the complexity ofbinary_search is described as
At most
log(last - first) + 2comparisons.
This should be precised and brought in line with the nomenclature used forlower_bound,upper_bound, andequal_range.
All existing libraries I'm aware of, delegate tolower_bound (+ one further comparison). Sinceissue384(i) has now WP status, the resolution of #787 shouldbe brought in-line with384(i) by changing the+ 2to+ O(1).
[Sophia Antipolis:]
Alisdair prefers to apply an upper bound instead of O(1), but that wouldrequire fixing for
lower_bound,upper_boundetc. as well. If he reallycares about it, he'll send an issue to Howard.
Proposed resolution:
Change 26.8.4.5[binary.search]/3
Complexity: At most
log2(last - first) +comparisons.2O(1)