New set class

Michiel nomail at please.com
Sat Feb 24 17:01:56 PST 2007


I have written a new class to represent sets, with several useful
features. Uploaded for your review and free use. I don't know much about
open source and licensing, but I request that if you use the class, that
you keep my name in the author section of the documentation.

http://files.michiel.eu/set.d

Tell me what you think.

There still are some problems, though. I could use some help:

* There are still problems involving static arrays as the set type. The
set literal creates a set of the exact type you specify. So if you use a
string literal, it will be a set of static char arrays. It is only a
sort of hack in the Set class that allows for the dynamic array
equivalent to also be accepted in. What I really need is to implement
the set literal function so it creates a set of the dynamic array type
directly. But I've run into some problems, sometimes strangely involving
char-encodings. (invalid UTF-8 sequence, printed to the terminal at
runtime when I try to print the toString())

* When I enable unit testing, several things can go wrong. Sometimes I
get a segmentation fault. Sometimes I get a program that doesn't
terminate and eats all of the memory until I kill it.

-- 
Michiel



More information about the Digitalmars-d mailing list