Using Sequence Range as a SortedRange.

D Lark dlark at example.com
Wed Jul 13 22:35:35 UTC 2022


On Wednesday, 13 July 2022 at 18:27:22 UTC, D Lark wrote:
> I am trying to use a sequence range as a sorted range so that I 
> can apply a search on it. For instance this might be used to 
> implement integer square root as so:
>
> [...]

For the first snippet, I did not get to that point, but it 
appears I would have to add a search policy to lower bound since 
the list is infinite and the default policy, binary search, 
requires both initial bounds. i.e:
>     auto lowerBounds = 
> seqAsSorted.lowerBound!(SearchPolicy.gallop)(n);


More information about the Digitalmars-d-learn mailing list