summaryrefslogtreecommitdiffhomepage
path: root/examples/sidebyside.cpp
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2022-12-20 23:31:51 +0100
committerTyge Lovset <[email protected]>2022-12-20 23:31:51 +0100
commit5f57d597cd27aef55adbcb3b452973b0c6e33667 (patch)
treedfd59c2fd0e36a6ef37912a9d0cc5a65970f1524 /examples/sidebyside.cpp
parent1763be8c8cbbc0896477fcf924edd4180d1345a9 (diff)
downloadSTC-modified-5f57d597cd27aef55adbcb3b452973b0c6e33667.tar.gz
STC-modified-5f57d597cd27aef55adbcb3b452973b0c6e33667.zip
Restructured folders: examples, benchmarks, tests into misc folder.
Diffstat (limited to 'examples/sidebyside.cpp')
-rw-r--r--examples/sidebyside.cpp57
1 files changed, 0 insertions, 57 deletions
diff --git a/examples/sidebyside.cpp b/examples/sidebyside.cpp
deleted file mode 100644
index 80c934a4..00000000
--- a/examples/sidebyside.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <iostream>
-#include <map>
-#include <string>
-#include <stc/cstr.h>
-
-#define i_type IIMap
-#define i_key int
-#define i_val int
-#include <stc/csmap.h>
-
-#define i_type SIMap
-#define i_key_str
-#define i_val int
-#include <stc/cmap.h>
-
-int main() {
- {
- std::map<int, int> hist;
- hist.emplace(12, 100).first->second += 1;
- hist.emplace(13, 100).first->second += 1;
- hist.emplace(12, 100).first->second += 1;
-
- for (auto i: hist)
- std::cout << i.first << ", " << i.second << std::endl;
- std::cout << std::endl;
- }
-
- c_auto (IIMap, hist)
- {
- IIMap_insert(&hist, 12, 100).ref->second += 1;
- IIMap_insert(&hist, 13, 100).ref->second += 1;
- IIMap_insert(&hist, 12, 100).ref->second += 1;
-
- c_foreach (i, IIMap, hist)
- printf("%d, %d\n", i.ref->first, i.ref->second);
- puts("");
- }
- // ===================================================
- {
- 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 (SIMap, food)
- {
- c_forlist (i, SIMap_raw, {{"burger", 5}, {"pizza", 12}, {"steak", 15}})
- SIMap_emplace(&food, c_PAIR(i.ref));
-
- c_foreach (i, SIMap, food)
- printf("%s, %d\n", cstr_str(&i.ref->first), i.ref->second);
- puts("");
- }
-}