Set class for D

BCS BCS at pathlink.com
Thu Apr 26 10:25:43 PDT 2007


Dan wrote:
> BCS Wrote:
> 
> 
>>Justin C Calvarese wrote:
>>
>>>Bill Baxter wrote:
>>>
>>>
>>>>There was some discussion a while back about a Set class.
>>>>I think Tango has one, but unfortunately I'm not on Tango yet.
>>
>>[...]
>>
>>>Also, I found these links in my personal bookmarks:
>>>http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.announce&article_id=7399 
>>>http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.announce&article_id=7401 
>>>
>>
>>Thanks :b, I'd forgotten I'd written that, (they are still some of the 
>>stranger code I worked on).
>>
>>
>>That aside, I also am looking for a set implementation. I'm going to 
>>need light weight (struct not class, can't hammer the heap), fast (O[1] 
>>for most ops), and I'll need add, remove and contains check. really 
>>void[T] AA's would do everything I need, if the performance is good 
>>enough. Oh and it must allow closed source use.
> 
> 
> AA's are good for that - they use a hash lookup, keep buffer size and occupied size separate and such.  The hash algorithm uses sub-optimal operators, but it is O(k) and performs rather well.  AA's are also rather convenient for closed source as they tend to be internally less legible.
> 
> Sincerely,
> Dan

However the data payload that can't be dropped could be a killer.



More information about the Digitalmars-d mailing list