I finalized BinaryHeap. It's pretty cool - it builds a forward range on top of a random-access range - typically T[] - or a random-access container - typically Array!T.

The difference is simple - if you build on top of a range the heap can't grow beyond the size of that range. Building on top of a container makes the heap growable.

Making BinaryHeap a range is actually pretty cool - just walking the heap is tantamount to lazily sorting the container. (Of course BinaryHeap has primitives in addition to the four range primitives.)

Do you agree with putting BinaryHeap in std.range (as opposed to std.container)?


Andrei

Reply via email to