Sorted Array Wrapper Range

Tobias Pankrath via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 6 06:14:17 PST 2014


On Saturday, 6 December 2014 at 14:10:21 UTC, Nordlöw wrote:
> On Thursday, 4 December 2014 at 07:58:25 UTC, Tobias Pankrath 
> wrote:
>>> I see two typical variants:
>>>
>>> - Direct: Always sorts on write() and modify()
>>> - Lazy: Sorts lazily on read()
>>>
>>> read() of course uses binarySearch
>>
>> You won't be able to grow that range, would you?
>
> Why, because of slice invalidation?

Because a RandomAccessRange has no means to grow in general. 
Compare your proposed wrapper to 
http://dlang.org/phobos/std_container.html#.BinaryHeap


More information about the Digitalmars-d-learn mailing list