On Wednesday, 5 August 2015 at 02:26:48 UTC, Meta wrote:
On Wednesday, 5 August 2015 at 01:27:53 UTC, Steven Schveighoffer wrote:
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

It looks like there was a breaking change made to BinaryHeap somewhere between 2.065 and the present. The code compiles fine on 2.065.

http://dpaste.dzfl.pl/65ba735d69e7

Interesting.

I notice that the output of the 'writefln("PQ: %s", pq.queue);' line is different in 2.065 as well. Presumably the change was made because if one is printing out a BinaryHeap, one is more likely interested in the contents of the heap rather than its signature?

I'm using 2.067.1.

Reply via email to