BinaryHeap

Agustin agustin.l.alvarez at hotmail.com
Thu Nov 7 05:05:25 PST 2013


On Thursday, 7 November 2013 at 12:45:11 UTC, Agustin wrote:
> On Thursday, 7 November 2013 at 12:29:44 UTC, bearophile wrote:
>> Agustin:
>>
>>> no property 'popFront' for type 'BinaryHeap!(uint[])'
>>
>> Try to use front and removeFront (I don't know why there is 
>> removeFront instead of popFront).
>>
>> Bye,
>> bearophile
>
> Saddly i had to do this
>
>     auto clone = _heap.dup;
>
>     while (!clone.empty())
>     {
>         auto item = clone.front();
>         // ... Do something with item
>         clone.removeFront();
>     }
>
> Iterate directly over a binary heap will be better perfomance 
> wise than doing that because i had to clone the heap to be able 
> to iterate over without removing items from the original heap.

By looking at the source, having "private @property ref Store 
_store()" public will help a lot.


More information about the Digitalmars-d-learn mailing list