summaryrefslogtreecommitdiffhomepage
path: root/examples/mapmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/mapmap.c')
-rw-r--r--examples/mapmap.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/mapmap.c b/examples/mapmap.c
index 7782f5bf..c55104c9 100644
--- a/examples/mapmap.c
+++ b/examples/mapmap.c
@@ -4,19 +4,19 @@
#include <stc/cstr.h>
using_cmap_str();
-using_cmap_strkey(cfg, cmap_str, cmap_str_del, cmap_str_clone);
+using_cmap_strkey(cfg, cmap_str, cmap_str_del);
int main(void) {
cmap_cfg config = cmap_cfg_init();
cmap_str init = cmap_str_init();
- cmap_str_put(&cmap_cfg_emplace(&config, "user", init).first->second, "name", "Joe");
- cmap_str_put(&cmap_cfg_emplace(&config, "user", init).first->second, "groups", "proj1,proj3");
- cmap_str_put(&cmap_cfg_emplace(&config, "group", init).first->second, "proj1", "Energy");
- cmap_str_put(&cmap_cfg_emplace(&config, "group", init).first->second, "proj2", "Windy");
- cmap_str_put(&cmap_cfg_emplace(&config, "group", init).first->second, "proj3", "Oil");
- cmap_str_put(&cmap_cfg_emplace(&config, "admin", init).first->second, "employees", "2302");
+ cmap_str_emplace(&cmap_cfg_insert(&config, cstr_from("user"), init).first->second, "name", "Joe");
+ cmap_str_emplace(&cmap_cfg_insert(&config, cstr_from("user"), init).first->second, "groups", "proj1,proj3");
+ cmap_str_emplace(&cmap_cfg_insert(&config, cstr_from("group"), init).first->second, "proj1", "Energy");
+ cmap_str_emplace(&cmap_cfg_insert(&config, cstr_from("group"), init).first->second, "proj2", "Windy");
+ cmap_str_emplace(&cmap_cfg_insert(&config, cstr_from("group"), init).first->second, "proj3", "Oil");
+ cmap_str_emplace(&cmap_cfg_insert(&config, cstr_from("admin"), init).first->second, "employees", "2302");
- cmap_str_put(&cmap_cfg_emplace(&config, "group", init).first->second, "proj2", "Wind"); // Update
+ cmap_str_emplace_put(&cmap_cfg_insert(&config, cstr_from("group"), init).first->second, "proj2", "Wind"); // Update
c_foreach (i, cmap_cfg, config)
c_foreach (j, cmap_str, i.ref->second)