This is an archive of the discontinued LLVM Phabricator instance.

[ADT] Implement llvm::bsearch() with std::partition_point()
ClosedPublic

Authored by MaskRay on Jun 24 2019, 7:57 AM.

Details

Summary

Delete the begin-end form because the standard std::partition_point
can be easily used as a replacement.

The ranges-style llvm::bsearch will be renamed to llvm::partition_point.

The name "bsearch" doesn't meet people's expectation because in C:

If two or more members compare equal, which member is returned is unspecified.

Event Timeline

MaskRay created this revision.Jun 24 2019, 7:57 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 24 2019, 7:57 AM
MaskRay updated this revision to Diff 206220.Jun 24 2019, 8:09 AM
MaskRay edited the summary of this revision. (Show Details)

Delete the begin-end form

MaskRay edited the summary of this revision. (Show Details)Jun 24 2019, 8:17 AM
sammccall accepted this revision.Jun 30 2019, 1:11 AM

Funny, the int version was the original motivation and now seems totally unused. And apparently none of us know the standard library very well.
Thanks for cleaning this up.

This revision is now accepted and ready to land.Jun 30 2019, 1:11 AM
This revision was automatically updated to reflect the committed changes.