I have a tree-like structure using Node
objects with references to other Node
objects. Node
is a class. Now, one of the routines I'm writing needs a minimum priority queue, which I'm implementing using std.container.BinaryHeap
and std.container.Array
. I'm instantiating it as follows:
Node[] r;
auto heap = BinaryHeap!(Array!(Node), "a > b")(Array!Node(r));
As part of the routine, I insert elements into heap
using insert
and remove elements from it using removeAny
. Now, the routine works correctly, but afterwards, the tree-like structure breaks (my invariants for it fail), due to nodes being missing. What's going on here and why is this happening?
could be http://d.puremagic.com/issues/show_bug.cgi?id=6998 - std.container.Array destroys class instances