Sorted Array Wrapper Range

Tobias Pankrath via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Dec 7 05:12:04 PST 2014


On Saturday, 6 December 2014 at 14:50:02 UTC, Nordlöw wrote:
> On Saturday, 6 December 2014 at 14:14:18 UTC, Tobias Pankrath 
> wrote:
>> Because a RandomAccessRange has no means to grow in general. 
>> Compare your proposed wrapper to 
>> http://dlang.org/phobos/std_container.html#.BinaryHeap
>
> So what should the basic operations in a SortedRange wrapper 
> template be? And how should the wrapped type be restricted?

Something like this 
https://github.com/Panke/phobos/blob/std_container_sorted/std/container/sorted.d

It should additionally support c.remove(r), c.removeKey(k), opIn 
and insertFront/removeFront if the underlying store supports them.

But that's pretty much it, I'd say.

Sadly, the unittest using an Array!int as store does not compile 
because of of linker errors. I'm using

rdmd -unittest -main std/container/sorted.d

but that does not work with std/container/array.d as well. So, my 
setup seems to be broken.


More information about the Digitalmars-d-learn mailing list