BinaryHeap is a range so it goes in std.range. Agree?
Simen kjaeraas
simen.kjaras at gmail.com
Tue Jun 8 08:00:33 PDT 2010
Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> 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)?
No. Binaryheap may work like a range, and it's definitely usable as a
range, but the associativity of my brain says it's a container.
I fear this will end up like enum for manifest constants, which behaves
the way it should, but does not belong in that location.
--
Simen
More information about the Digitalmars-d
mailing list