[Feature Request] Adding to D lang "set" built-in

Jonathan M Davis jmdavisProg at gmx.com
Sun May 6 22:53:46 PDT 2012


On Monday, May 07, 2012 06:49:00 Russel Winder wrote:
> On Mon, 2012-05-07 at 00:42 +0200, Andrej Mitrovic wrote:
> > On 5/7/12, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> > > you may be better off adapting D's AA implementation
> > > to have an AA that consists of just keys.
> > 
> > Yeah I do that in my code right now. It's pretty easy, just write an
> > some opApply/opBinary functions, add to!string(innerhash.keys) for
> > good measure and you're set (heh, set).
> 
> Any language with which the programmer has to develop their own set
> implementation is sadly lacking.
> 
> It is true that set can be implemented using a map, but this should be
> seen as implementation detail, not as programmer level tool. It
> indicates that set should exist where set does. So for C++ it is in the
> standard library, for Python it is a built-in (*).
> 
> The conclusion for D is straightforward. Which issue to I go to to vote?

We have RedBlackTree, so we have a set already. What we don't have is a 
HashSet. However, once the custom allocator stuff has been sorted out, I'd 
fully expect to have one in std.container along with a variety of other 
container types which we really should have but don't.

- Jonathan M Davis


More information about the Digitalmars-d mailing list