growable BinaryHeap

Matthias Frei matfrei at ethz.ch
Fri Nov 18 05:15:41 PST 2011


Hi guys,

does anybody know how to use std.container.BinaryHepa as a growable heap?
Using T[] as Store is annoying since one has to do
   T[] store = heap.release();
   store ~= newElement;
   heap.acquire(store);
to insert an element into the heap, as BinaryHeap is not able to append 
to ranges.
Using Array!(T) does not work neither because of Bug 6959.

I tried to define the method insertBack() for T[] but I failed.

What kind of data structure can I use, without having to write a an 
array myself?

Thank you!


More information about the Digitalmars-d-learn mailing list