a sets implementation

Michiel nomail at hotmail.com
Wed Feb 7 01:51:21 PST 2007


Not bad. I like how you have integrated some set operations. I posted my own
implementation earlier. And while it is much shorter, it doesn't overload any
operators and is of course not nicely encapsulated like yours.

I would do some things differently, though. For example:

* You copy array-elements over one by one. You can also use array.dup.
* You use a try-catch block for contains(). It's better if you reserve that for
exceptional circumstances. You can also use the 'in' operator.
* I would overload the 'in' operator anyway.



More information about the Digitalmars-d mailing list