Sorted Array Wrapper Range

Xinok via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Dec 3 20:24:24 PST 2014


On Wednesday, 3 December 2014 at 21:02:05 UTC, Nordlöw wrote:
> Have anybody written a generic automatically sorted range 
> wrapper for RandomAccessRanges?
>
> I guess
>
> http://dlang.org/library/std/range/assumeSorted.html
>
> should play a key role.
>
> I see two typical variants:
>
> - Direct: Always sorts on write() and modify()
> - Lazy: Sorts lazily on read()
>
> read() of course uses binarySearch

There was a relevant discussion about a month ago here:
http://forum.dlang.org/thread/uhfpppdslxdghyconlfr@forum.dlang.org

Otherwise, there's RedBlackTree, but I'm not aware of anything 
that works over any random-access range.


More information about the Digitalmars-d-learn mailing list