cn_map / cn_map_erase
Syntax
void cn_map_erase(CN_MAP map, CNM_ITERATOR * iterator)
Description
Erases a node in the CN_Map
map being pointed to by
iterator. If a destructor function is set via
cn_map_set_func_destructor, that destructor is called upon the node's erasure.
Return Value
N/A
Examples
Basic Usage
#include <stdio.h>
#include <stdlib.h>
#include "cn_cmp.h"
#include "cn_map.h"
main() {
CN_MAP map = cn_map_init(char, int, cn_cmp_char);
char key = 'd';
int value = 4;
//Insert element into the map
cn_map_insert(map, &key, &value);
//Find 'd'
CNM_ITERATOR it;
cn_map_find(map, &it, &key);
//Delete from the map
cn_map_erase(map, &it);
cn_map_free(map);
}