Bug 8829 – std.algorithm.find fails to take advantage of SortedRange
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-10-15T22:18:00Z
Last change time
2017-01-16T23:25:35Z
Keywords
bootcamp
Assigned to
razvan.nitu1305
Creator
issues.dlang
Comments
Comment #0 by issues.dlang — 2012-10-15T22:18:53Z
find should be able to take advantage of SortedRange at least some of the time. At minimum, the overload which takes a single element for the needle should use upperBound on SortedRange rather than searching through the range element by element. I don't know how often it can really take advantage of it, because it must be able to verify that the predicates are the same, but that should be feasible for at least the default predicate (and probably any string predicate).
Similarly, canFind should be able to use SortedRange's contains function.
Comment #1 by github-bugzilla — 2016-12-06T22:57:16Z