Containers I'd like to see in std.containers

Philippe Sigaud philippe.sigaud at gmail.com
Mon May 31 12:47:04 PDT 2010


On Mon, May 31, 2010 at 01:56, Andrei Alexandrescu <
SeeWebsiteForEmail at erdani.org> wrote:

> On 05/30/2010 04:53 PM, Philippe Sigaud wrote:
>
>> There are some simple containers I'd like to see in std.containers:
>>
>> - a priority queue
>> - a heap
>>
>
> What's the difference between the two?
>

Looking at some old code of mine, not much. Once you have a BinaryHeap, a
PriorityQueue!(Payload,Priority) is just a BinaryHeap!(Tuple!(Payload,
Priority))
with a sorter acting on the tuple's second field and front() (or whatever
it's called for containers) returning the first field.
And, of course, nice creating functions.

So, heap is the basis, priority queue is just a nice wrapper. But I want
nice wrappers! They are easy to code, and gives joe phobos what he wants.



>
>  - a stack, a queue
>>
>
> These are adaptors over other containers, I agree they should be in.
>

Yes, an adaptor with a default implementation. Do you consider built-in
arrays (not slices) to be containers?



>
>  - a set
>>
>
> Yah, though I want std.container to focus on implementation, not policy.
>

Please, a set, please, a set!
I mean, where would you put it otherwise?



Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20100531/f4cb2d1a/attachment-0001.html>


More information about the Digitalmars-d mailing list