Port a benchmark to D?

Timon Gehr timon.gehr at gmx.ch
Fri Jun 3 14:30:54 PDT 2011


Jonathan M Davis wrote:
> On 2011-06-03 14:08, Timon Gehr wrote:
> > Andrei Alexandrescu wrote:
> > > I noticed that the C++ code uses std::list without there being any need
> > > for a linked list structure. See for example the data structure used in
> > > FindSet. It's a list, but it's just appended too and then used for one
> > > iteration.
> > >
> > > Andrei
> >
> > Yes, but the list in FindSet is unnecessary anyways. If I start changing
> > the original implementation, the first thing I will do is to remove that.
> >
> > First however, I will port the code as closely as possible. Is there any
> > associative version of RedBlackTree (I realize it could be made associative
> > quite easily), or should I just use built-in hash maps?
>
> You give RedBlackTree a different predicate if you want to treat it as a map.
> It defaults to "a < b" with allowDuplicates as false, which makes it a
> multiset. But If you adjust its template parameters, you can make it a set,
> map, multimap, or any other type of collection which uses a red-black tree > as
> its data structure.
>
> - Jonathan M Davis

Yes, thats what I had in mind, but I thought it is strange that there is no
boilerplate map in std.container.

Timon


More information about the Digitalmars-d mailing list