summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/new_map.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-01-31 12:53:46 +0100
committerTyge Løvset <[email protected]>2023-01-31 12:53:46 +0100
commit5bbcae2a3add163ea3b7a91d65fda6836c18f410 (patch)
tree304ab8ca8f632f56e53ee2bc568fb834da91b13c /misc/examples/new_map.c
parent209bf743e0c1253a4bc81d2ffb6897f657a84c8a (diff)
downloadSTC-modified-5bbcae2a3add163ea3b7a91d65fda6836c18f410.tar.gz
STC-modified-5bbcae2a3add163ea3b7a91d65fda6836c18f410.zip
Updates, and prepare for the big unsigned ==> signed transformation.
Diffstat (limited to 'misc/examples/new_map.c')
-rw-r--r--misc/examples/new_map.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/misc/examples/new_map.c b/misc/examples/new_map.c
index 72705eb2..9cee987d 100644
--- a/misc/examples/new_map.c
+++ b/misc/examples/new_map.c
@@ -48,24 +48,25 @@ int main()
c_AUTO (cset_str, sset)
{
cmap_int_insert(&map, 123, 321);
+ cmap_int_insert(&map, 456, 654);
+ cmap_int_insert(&map, 789, 987);
- c_FORLIST (i, cmap_pnt_raw, {{{42, 14}, 1}, {{32, 94}, 2}, {{62, 81}, 3}})
- cmap_pnt_insert(&pmap, c_PAIR(i.ref));
+ pmap = c_make(cmap_pnt, {{{42, 14}, 1}, {{32, 94}, 2}, {{62, 81}, 3}});
c_FOREACH (i, cmap_pnt, pmap)
printf(" (%d, %d: %d)", i.ref->first.x, i.ref->first.y, i.ref->second);
puts("");
- c_FORLIST (i, cmap_str_raw, {
+ smap = c_make(cmap_str, {
{"Hello, friend", "long time no see"},
- {"So long, friend", "see you around"},
- }) cmap_str_emplace(&smap, c_PAIR(i.ref));
+ {"So long", "see you around"},
+ });
- c_FORLIST (i, const char*, {
+ sset = c_make(cset_str, {
"Hello, friend",
"Nice to see you again",
- "So long, friend",
- }) cset_str_emplace(&sset, *i.ref);
+ "So long",
+ });
c_FOREACH (i, cset_str, sset)
printf(" %s\n", cstr_str(i.ref));