[libcxx-commits] [libcxx] [libc++] Introduce one-sided binary search for lower_bound on non-random iterators, and use that to improve the average complexity of set_intersection. (PR #75230)
Iuri Chaer via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 12 10:55:30 PST 2023
ichaer wrote:
Hi Mark, thanks for your reply!
Strictly speaking, yes, that is true: the number of comparisons may violate the requirement of there being at most log(last - first) + O(1) projections and comparisons. However, that is only being done for non-random access iterators, where we are also executing 2*(last-first) iterator mutations, which are not part of the explicit algorithm guarantees, and are the reason why std::set and std::map have their own lower_bound -- std::lower_bound is really hard to use on non-random iterators because of this additional cost.
Would this be a blocker for accepting the contribution?
https://github.com/llvm/llvm-project/pull/75230
More information about the libcxx-commits
mailing list