summaryrefslogtreecommitdiffhomepage
path: root/examples/sidebyside.cpp
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-12-29 15:14:37 +0100
committerGitHub <[email protected]>2021-12-29 15:14:37 +0100
commita53b2f4269951e0b5340723670137b4fdf96534c (patch)
treee5d36c28d0fd548873216426bb00a6b59d2730dd /examples/sidebyside.cpp
parent183a89859ba9914ee0546e4482b40be199e52292 (diff)
parent92f5421493932d00e63b33152331a36cc4fc9491 (diff)
downloadSTC-modified-a53b2f4269951e0b5340723670137b4fdf96534c.tar.gz
STC-modified-a53b2f4269951e0b5340723670137b4fdf96534c.zip
Merge pull request #17 from tylov/version3
Version3 Breaking changes are covered by the migration guide in the NEWS section in README.md
Diffstat (limited to 'examples/sidebyside.cpp')
-rw-r--r--examples/sidebyside.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/examples/sidebyside.cpp b/examples/sidebyside.cpp
index 0f645991..435b37f6 100644
--- a/examples/sidebyside.cpp
+++ b/examples/sidebyside.cpp
@@ -8,18 +8,20 @@
#define i_key int
#define i_val int
-#include <stc/cmap.h>
+#include <stc/csmap.h>
int main() {
{
- std::map<std::string, int> food = {{"burger", 5}, {"pizza", 12}, {"steak", 15}};
+ std::map<std::string, int> food =
+ {{"burger", 5}, {"pizza", 12}, {"steak", 15}};
for (auto i: food)
std::cout << i.first << ", " << i.second << std::endl;
std::cout << std::endl;
}
c_auto (cmap_str, food)
{
- c_apply_pair(cmap_str, emplace, &food, {{"burger", 5}, {"pizza", 12}, {"steak", 15}});
+ c_apply(v, cmap_str_emplace(&food, c_pair(v)), cmap_str_raw,
+ {{"burger", 5}, {"pizza", 12}, {"steak", 15}});
c_foreach (i, cmap_str, food)
printf("%s, %d\n", i.ref->first.str, i.ref->second);
puts("");
@@ -34,12 +36,12 @@ int main() {
std::cout << i.first << ", " << i.second << std::endl;
std::cout << std::endl;
}
- c_auto (cmap_int, hist)
+ c_auto (csmap_int, hist)
{
- ++ cmap_int_emplace(&hist, 12, 100).ref->second;
- ++ cmap_int_emplace(&hist, 13, 100).ref->second;
- ++ cmap_int_emplace(&hist, 12, 100).ref->second;
- c_foreach (i, cmap_int, hist)
+ ++ csmap_int_emplace(&hist, 12, 100).ref->second;
+ ++ csmap_int_emplace(&hist, 13, 100).ref->second;
+ ++ csmap_int_emplace(&hist, 12, 100).ref->second;
+ c_foreach (i, csmap_int, hist)
printf("%d, %d\n", i.ref->first, i.ref->second);
puts("");
}