diff options
author | Tucker Evans <tucker@tuckerevans.com> | 2020-07-06 15:49:49 -0400 |
---|---|---|
committer | Tucker Evans <tucker@tuckerevans.com> | 2020-07-08 10:56:36 -0400 |
commit | 50846316de122801e07511d4e3771a4561efa5ad (patch) | |
tree | 8f3edaafdeac9551781d823ac20f5c869a1d3c08 /collections/map/map.adoc | |
parent | cf427c05b05e0409cfdeb6bc30b69070dd1700c3 (diff) |
Add size function for maps
Diffstat (limited to 'collections/map/map.adoc')
-rw-r--r-- | collections/map/map.adoc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/collections/map/map.adoc b/collections/map/map.adoc index fc6b8b7..837a08a 100644 --- a/collections/map/map.adoc +++ b/collections/map/map.adoc @@ -1,7 +1,7 @@ Map === Tucker Evans -v0.1, 2020-07-06 +v0.2, 2020-07-06 A basic map implemented in an AVL tree. @@ -50,3 +50,22 @@ Examples map *dict = map_new((cmp_func) strcmp); ---- + +[[map_size]] ++map_size(map *self)+ +~~~~~~~~~~~~~~~~~~~~~ +Returns the number of key, value pairs stored in map +self+. + +Examples +^^^^^^^^ +[source,c] +---- +#include "map.h" +#include <string.h> + +map *dict = map_new((cmp_func) strcmp); + +assert(map_size(dict) == 0); +map_set(dict, "ONE", NULL); +assert(map_size(dict) == 1); +---- |