dcollections 0.01 release
Steven Schveighoffer
schveiguy at yahoo.com
Tue May 6 15:36:35 PDT 2008
"torhu" wrote
> Steven Schveighoffer wrote:
>> I've been tinkering with a collection package that is a hybrid between
>> C++, Java, and Tango, utilizing the best D features (such as slicing,
>> foreach, etc.).
>
> Interesting stuff. Any plans for adding sorting?
I wasn't planning on it...
I think sorting really only makes sense in cases where quick lookup is
possible. The implementations I support are:
RBTree -> already sorted
Hash -> can't be sorted
Link -> don't have quick lookup.
Array -> possible to sort using the built-in array sort:
ArrayList!(int) x([5,4,3,2,1]);
x.asArray.sort;
Basically, for ArrayList, any possible sort routines that are written for
builtin arrays can be applied.
For unsortable implementations, they can be 'sorted' by adding them to a
Tree implementation, which will sort on insertion. Or if you like, turned
into an array, and sorted there.
Is there another requirement I'm missing?
-Steve
More information about the Digitalmars-d-announce
mailing list