# CMC The main C Macro Collections. The C Macro Collections library was created out of necessity. To create powerful data structures of any type without the constant use of macros and `void *` pointers, but at the same time being [type-safe](https://en.wikipedia.org/wiki/Type_safety). These collections are generated by macros containing a template. These templates allow for some much needed customizations including the data type you wish to handle. In the `cmc` folder is the default implementation of all collections. There is also a `dev` folder that pretty much has the same macros that expand to the same code, except that they have an extensive use of logging that might be useful for debugging or getting to know what is happening in your program. There is also the `sac` collections that are statically allocated (have a fixed sized buffer). ## Quick Example Let's say you need a HashMap mapping keys of type `char *` to `int`. All you need to do is: ```c #include "cmc/hashmap" // CMC_GENERATE_HASHMAP(PFX, SNAME, K, V) CMC_GENERATE_HASHMAP(map, hashmap, char *, int) int main(void) { // Here you have full functionalities of a HashMap // No more macros needed! // Every function can be found in the 'map_' prefix and are all type-safe } ``` You can customize the functions prefix (`PFX`) and the `struct` name (`SNAME`). The macro `CMC_GENERATE_HASHMAP` will expand to all the code that you will need to operate on a HashMap with `char *` keys and `int` values. The only thing left to do is to define a hash function and a comparator functions for the keys of this map. In case of `char *` you can find these functions in `utl/futils.h` or make your own. To know which collections require which functions check out [Functions Table](../cor/functions_table/index.html) or the documentation for each collection.