BinaryHeap is a range so it goes in std.range. Agree?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Jun 8 07:47:33 PDT 2010
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
More information about the Digitalmars-d
mailing list