BinaryHeap

Agustin agustin.l.alvarez at hotmail.com
Thu Nov 7 04:45:09 PST 2013


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.


More information about the Digitalmars-d-learn mailing list