summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/sidebyside.cpp
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2023-04-12 15:55:33 -0400
committerrealtradam <[email protected]>2023-04-12 15:55:33 -0400
commit0841165881871ee01b782129be681209aeed2423 (patch)
tree8a76b61dcaab381b6b42305201ae8b6259f6b6c0 /misc/examples/sidebyside.cpp
parent554f3e8acf7855b5d6a90cc68cefb7445460b03c (diff)
parent0516aa3ae823ed9a22b2c5f776948c8447c32c31 (diff)
downloadSTC-modified-0841165881871ee01b782129be681209aeed2423.tar.gz
STC-modified-0841165881871ee01b782129be681209aeed2423.zip
Merge branch 'master' into modified
Diffstat (limited to 'misc/examples/sidebyside.cpp')
-rw-r--r--misc/examples/sidebyside.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/misc/examples/sidebyside.cpp b/misc/examples/sidebyside.cpp
index 80c934a4..a7c1008c 100644
--- a/misc/examples/sidebyside.cpp
+++ b/misc/examples/sidebyside.cpp
@@ -24,9 +24,8 @@ int main() {
std::cout << i.first << ", " << i.second << std::endl;
std::cout << std::endl;
}
-
- c_auto (IIMap, hist)
- {
+ {
+ IIMap hist = {0};
IIMap_insert(&hist, 12, 100).ref->second += 1;
IIMap_insert(&hist, 13, 100).ref->second += 1;
IIMap_insert(&hist, 12, 100).ref->second += 1;
@@ -34,6 +33,7 @@ int main() {
c_foreach (i, IIMap, hist)
printf("%d, %d\n", i.ref->first, i.ref->second);
puts("");
+ IIMap_drop(&hist);
}
// ===================================================
{
@@ -44,14 +44,14 @@ int main() {
std::cout << i.first << ", " << i.second << std::endl;
std::cout << std::endl;
}
-
- c_auto (SIMap, food)
{
+ SIMap food = {0};
c_forlist (i, SIMap_raw, {{"burger", 5}, {"pizza", 12}, {"steak", 15}})
- SIMap_emplace(&food, c_PAIR(i.ref));
+ SIMap_emplace(&food, i.ref->first, i.ref->second);
c_foreach (i, SIMap, food)
printf("%s, %d\n", cstr_str(&i.ref->first), i.ref->second);
puts("");
+ SIMap_drop(&food);
}
}