Keeping a dynamic sorted range

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 9 18:19:56 PST 2014


On 11/7/14 7:54 AM, bearophile wrote:
> Max Klyga:
>
>> Ranges are not container. They are meant for traversing. If you want a
>> sorted range - use an underlying container that preserves ordering
>> (trees, heaps)
>
> Let's asssume that the underlying container is a sorted built-in dynamic
> array (that has more locality than a tree and allows very fast binary
> searches, unlike a heap).
>
> So what solution do you suggest? A pair of functions that work on a
> sorted container of that type for Phobos?
>
> Bye,
> bearophile

One possibility is a function sortedChain that takes two or more sorted 
ranges and returns a lazy sorted range. -- Andrei


More information about the Digitalmars-d mailing list