SortedRange
Ali Çehreli
acehreli at yahoo.com
Fri Nov 29 08:50:23 PST 2013
On 11/29/2013 06:12 AM, Andrea Fontana wrote:
> I see that SortedRange has a special "contains" method:
>
> "Returns true if and only if value can be found in range, which is
> assumed to be sorted. Performs Ο(log(r.length)) evaluations of pred."
>
> Why there's no "find" method?
> find() inside std.algorithm seems to scan every element inside range.
> Why doesn't it use a binary search?
>
> Andrea
Binary search is spelled as SortedRange.lowerBound (and its friends). :)
Ali
More information about the Digitalmars-d-learn
mailing list