digitalmars.D - Minimal Template Library 1.0
- Ben Hinkle (20/20) Aug 09 2004 I've made some more updates to MinTL and expanded the documentation (I
- Ivan Senji (14/34) Aug 17 2004 I would like to use SortedAA to create a set class, and as far as i
- Ben Hinkle (25/65) Aug 18 2004 Anything that can go into a builtin AA can go into a SortedAA since the
I've made some more updates to MinTL and expanded the documentation (I didn't use the output of doxygen since it choked too often). It has settled enough to warrent a 1.0 version. I put the code in the public domain so do with it whatever you want. It is available at http://home.comcast.net/~benhinkle/mintl/ MinTL supports: - containers: doubly linked list, sorted associative array (red-black tree), associative arrays ordered by insertion order, circular array lists, aliases for other containers - semantics of containers follow the model of dynamic arrays and associative arrays where possible. Most importantly slices of a container have the same type as the original container. Memory usage and garbage generation is kept to a minimum. - polymorphic sequence of values or key-value pairs plus the ability to map sequences by a delegate (ala Lisp/Python), find sub-sequences that satisfy a condition and concatenate an arbitrary number of sequences. (function literals are awesome for defining maps and conditions!) - helper functions for builtin arrays to reserve space, reset associative arrays, iterate backwards over the array and efficiently look up elements in associative arrays
Aug 09 2004
I would like to use SortedAA to create a set class, and as far as i understand it every object in AA is unique(there can not be two which are the same) So what does my class that is a key to SortedAA have to provide and how do these functions have to work to do this (and what are their prototypes?) I suspect opCmp and opEquals? "Ben Hinkle" <bhinkle4 juno.com> wrote in message news:cf9av3$16ea$1 digitaldaemon.com...I've made some more updates to MinTL and expanded the documentation (I didn't use the output of doxygen since it choked too often). It hassettledenough to warrent a 1.0 version. I put the code in the public domain so do with it whatever you want. It is available at http://home.comcast.net/~benhinkle/mintl/ MinTL supports: - containers: doubly linked list, sorted associative array (red-blacktree),associative arrays ordered by insertion order, circular array lists, aliases for other containers - semantics of containers follow the model of dynamic arrays andassociativearrays where possible. Most importantly slices of a container have thesametype as the original container. Memory usage and garbage generation iskeptto a minimum. - polymorphic sequence of values or key-value pairs plus the ability tomapsequences by a delegate (ala Lisp/Python), find sub-sequences that satisfy a condition and concatenate an arbitrary number of sequences. (function literals are awesome for defining maps and conditions!) - helper functions for builtin arrays to reserve space, reset associative arrays, iterate backwards over the array and efficiently look up elements in associative arrays
Aug 17 2004
Anything that can go into a builtin AA can go into a SortedAA since the
SortedAA uses the same TypeInfo mechanism that the builtin AAs use. In
particular the TypeInfo getHash(), compare(), equals() and swap() functions
are used. For keys that are class objects the class can either use the
default Object implementations of opCmp and opEquals or it can override
them. The signatures of the overriding functions should be
uint toHash();
int opCmp(Object o);
int opEquals(Object o);
Note also the mintl.util module defines an alias for SortedSet:
template SortedSet(Key) {
alias SortedAA!(Key,Key) SortedSet;
}
Add items to the set using "x[key]=key" and query using "x.opIn(key)". For
example
SortedSet!(int) x;
x[10] = 10;
assert( x.opIn(10) );
foreach( int val; x ) printf(" %d",val);
"Ivan Senji" <ivan.senji public.srce.hr> wrote in message
news:cftvdc$1hd4$1 digitaldaemon.com...
I would like to use SortedAA to create a set class, and as far as i
understand it
every object in AA is unique(there can not be two which are the same)
So what does my class that is a key to SortedAA have to provide and how
do these functions have to work to do this (and what are their
prototypes?)
I suspect opCmp and opEquals?
"Ben Hinkle" <bhinkle4 juno.com> wrote in message
news:cf9av3$16ea$1 digitaldaemon.com...
I've made some more updates to MinTL and expanded the documentation (I
didn't use the output of doxygen since it choked too often). It has
settled
enough to warrent a 1.0 version. I put the code in the public domain so
do with it whatever you want. It is available at
http://home.comcast.net/~benhinkle/mintl/
MinTL supports:
- containers: doubly linked list, sorted associative array (red-black
tree),
associative arrays ordered by insertion order, circular array lists,
aliases for other containers
- semantics of containers follow the model of dynamic arrays and
associative
arrays where possible. Most importantly slices of a container have the
same
type as the original container. Memory usage and garbage generation is
kept
to a minimum.
- polymorphic sequence of values or key-value pairs plus the ability to
map
sequences by a delegate (ala Lisp/Python), find sub-sequences that
satisfy
a condition and concatenate an arbitrary number of sequences. (function
literals are awesome for defining maps and conditions!)
- helper functions for builtin arrays to reserve space, reset
associative
arrays, iterate backwards over the array and efficiently look up
elements
in associative arrays
Aug 18 2004








"Ben Hinkle" <bhinkle mathworks.com>