enum { COLLECTION_DEFAULT_SIZE = 10 }; typedef enum collection_do_ret { COLLECTION_DO_STOP = false, COLLECTION_DO_CONTINUE = true } collection_do_ret; /** * each function accepts element p from the array and user defined arg pointer. */ typedef collection_do_ret (*collectioneach)(void *p, void *arg); /** * detect function accepts element p and user defined arg pointer. * @return true if p is the item searching for, and false otherwise */ typedef bool (*collectiondetect)(void *p, void *arg); /** * @return an uint hash value for p. */ typedef uint (*collectionhash)(void *p); /** default hash function that returns the pointer's addess */ uint collection_address_hash(void *p); /** hash function for string p */ uint collection_string_hash(void *p); /** * @return true if p1 equals p2, false otherwise. */ typedef bool (*collectionisequal)(void *p1, void *p2); /** default freeing functor that calls free on each p */ collection_do_ret collection_free_each(void *p, void *);