Equivilent of STL Set in D ? ...

clayasaurus clayasaurus at gmail.com
Wed Oct 18 14:29:21 PDT 2006


Hello, I am converting some C++ code which happens to use STL Set to D. 
I was thinking of ways to implement set in D, but since I never got much 
into STL set in C++ I want to make sure I am thinking right.

1) Are D's associative arrays equivalent to STL Set? I've read that Set 
is pretty much just a sorted associative array, can this functionality 
be achieved in D (using struct as a key type) by overloading opCmp?

2) I suppose I could implement this as a sorted linked list. As far as I 
can tell set is only being used to hold a collection of elements that 
are sorted in a certain way.

3) Use DTL's implementation of set.

Thanks.
~ Clay



More information about the Digitalmars-d-learn mailing list