Keeping a dynamic sorted range

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 8 02:31:45 PST 2014


Jakob Ovrum:

> Of course, positional container primitives like `insertFront` 
> and `insertBack` will not be supported.

Sometimes (or often) "insertBack" (or better the ~= operator) is 
what I want, because I add items larger than ones already 
present. insertBack has to verify the array is empty, or the last 
one is smaller (or verifies the sorting predicate) than the item 
I'm going to append.


> is it really useful to have something like this that aims to 
> support such a wide range of underlying containers? Is it 
> actually useful in real programs for anything but arrays? So, I 
> stopped working on it...

In most cases a built-in dynamic array is fine. Once in a while 
you want to use an std.array.Array. When they are not enough, I 
use a sorted tree or something else.

Bye,
bearophile


More information about the Digitalmars-d mailing list