Creating a Priority Queue: An Adventure
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Aug 4 18:27:52 PDT 2015
On 8/4/15 9:02 PM, DarthCthulhu wrote:
> writefln("PQ: %s", pq.queue); <- prints PQ: [Tuple!(int, string)(3,
> "HELLO3"), Tuple!(int, string)(10, "HELLO10"), Tuple!(int, string)(11,
> "HELLO11")]
This is probably consuming your queue, popping all the data off as it
prints. If you print the length before hand, I'll bet it's not zero.
I don't know how to print the elements without removing them, as binary
heap doesn't have a range type, it seems to be the range itself (an odd
situation). Perhaps print the underlying storage?
-Steve
More information about the Digitalmars-d-learn
mailing list