Creating a Priority Queue: An Adventure

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 5 02:04:52 PDT 2015


On Wednesday, 5 August 2015 at 01:02:56 UTC, DarthCthulhu wrote:
> I must be doing something really stupid here, but I have no 
> clue what it is. Anyone know?


For functional behaviour I prefer a postblit that duplicates the 
underlying BinaryHeap.

https://github.com/nordlow/justd/blob/master/priority_queue.d

Now the foreach won't consume the queue.

This will however duplicate the underlying array aswell, which is 
probably not what we want. How do we avoid this?


More information about the Digitalmars-d-learn mailing list