BinaryHeap is a range so it goes in std.range. Agree?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Jun 9 07:57:40 PDT 2010
On 06/09/2010 06:20 AM, Simen kjaeraas wrote:
> Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
>> It's a good point. I agree it would make sense to define a binary heap
>> container in addition to a binary heap range. I'm only weary that they
>> don't have very clean means to reuse code, so we'll end up with some
>> unpleasant implementation internals. I guess I'll just have to do that.
>
> I fear that this will also lead to confusion. "What? Two binheaps? What
> do they need that for?" Basically, the binheap range is a heapifying
> range, yes?
>
> So to me, it seems to make sense to have std.range.heapify, and
> std.container.binheap.
The problem is that operating on a range as a heap is not just one
operation (i.e. heapify), it's a handful of them. STL took the approach
of providing make_heap, push_heap, pop_heap, sort_heap, and is_heap.
Their use is quite clunky. I think that's too unstructured an approach
and would like to improve on it.
Andrei
More information about the Digitalmars-d
mailing list