diff options
| author | Tyge Løvset <[email protected]> | 2020-09-16 09:05:06 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-09-16 09:05:06 +0200 |
| commit | 47b096d57f2d716db40a9ec6e724c2a76038778d (patch) | |
| tree | b6720b8cef663aaf0bdd9f92fbd892e98a80a318 /examples/mapmap.c | |
| parent | 0ce57669673a5a22d8207ec884bcebb97cb18448 (diff) | |
| download | STC-modified-47b096d57f2d716db40a9ec6e724c2a76038778d.tar.gz STC-modified-47b096d57f2d716db40a9ec6e724c2a76038778d.zip | |
Changed API to conform with std:: containers. cmap now only use first, second. for result and value types.
Diffstat (limited to 'examples/mapmap.c')
| -rw-r--r-- | examples/mapmap.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/mapmap.c b/examples/mapmap.c index 94f4139e..50806e3d 100644 --- a/examples/mapmap.c +++ b/examples/mapmap.c @@ -9,18 +9,18 @@ c_cmap_strkey(cfg, cmap_str, cmap_str_destroy); int main(void) {
cmap_cfg config = cmap_ini;
cmap_str init = cmap_ini;
- cmap_str_put(&cmap_cfg_emplace(&config, "user", init).first->value, "name", "Joe");
- cmap_str_put(&cmap_cfg_emplace(&config, "user", init).first->value, "groups", "proj1,proj3");
- cmap_str_put(&cmap_cfg_emplace(&config, "group", init).first->value, "proj1", "Energy");
- cmap_str_put(&cmap_cfg_emplace(&config, "group", init).first->value, "proj2", "Windy");
- cmap_str_put(&cmap_cfg_emplace(&config, "group", init).first->value, "proj3", "Oil");
- cmap_str_put(&cmap_cfg_emplace(&config, "admin", init).first->value, "employees", "2302");
+ 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_put(&cmap_cfg_emplace(&config, "group", init).first->value, "proj2", "Wind"); // Update
+ cmap_str_put(&cmap_cfg_emplace(&config, "group", init).first->second, "proj2", "Wind"); // Update
c_foreach (i, cmap_cfg, config)
- c_foreach (j, cmap_str, i.get->value)
- printf("%s: %s - %s (%u)\n", i.get->key.str, j.get->key.str, j.get->value.str, i.get->value.bucket_count);
+ c_foreach (j, cmap_str, i.get->second)
+ printf("%s: %s - %s (%u)\n", i.get->first.str, j.get->first.str, j.get->second.str, i.get->second.bucket_count);
cmap_cfg_destroy(&config);
}
\ No newline at end of file |
