A simple hashmap with owned keys and non-owned values. It handles conflicts through linear probing and has static size.
map_t* map = mapCreate(10);
my_type_t value;
mapSet("key", &value);
my_type_t *resolved;
resolved = mapGet("key");
my_type_t *deleted;
deleted = mapDelete("key");
myTypeDestroy(deleted); // values are owned by the caller
mapDestroy(&map);
Create a new map with the specified size.
map_t* map = mapCreate(10);
Set a key-value pair in the map. The key is copied and owned by the map.
my_type_t value;
mapSet(map, "key", &value);
Get a value from the map by its key.
my_type_t* result = mapGet(map, "key");
Delete a key-value pair from the map and return the value.
my_type_t* deleted = mapDelete(map, "key");
myTypeDestroy(deleted);
Destroy the map and free all allocated memory.
mapDestroy(&map);