summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/sso_map.c
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 /misc/examples/sso_map.c
parent1763be8c8cbbc0896477fcf924edd4180d1345a9 (diff)
downloadSTC-modified-5f57d597cd27aef55adbcb3b452973b0c6e33667.tar.gz
STC-modified-5f57d597cd27aef55adbcb3b452973b0c6e33667.zip
Restructured folders: examples, benchmarks, tests into misc folder.
Diffstat (limited to 'misc/examples/sso_map.c')
-rw-r--r--misc/examples/sso_map.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/misc/examples/sso_map.c b/misc/examples/sso_map.c
new file mode 100644
index 00000000..cc5e16a1
--- /dev/null
+++ b/misc/examples/sso_map.c
@@ -0,0 +1,17 @@
+#include <stc/cstr.h>
+#define i_key_str
+#define i_val_str
+#include <stc/cmap.h>
+
+int main()
+{
+ c_auto (cmap_str, m) {
+ cmap_str_emplace(&m, "Test short", "This is a short string.");
+ cmap_str_emplace(&m, "Test long ", "This is a longer string.");
+
+ c_forpair (k, v, cmap_str, m)
+ printf("%s: '%s' Len=%" c_ZU ", Is long: %s\n",
+ cstr_str(_.k), cstr_str(_.v), cstr_size(_.v),
+ cstr_is_long(_.v)?"true":"false");
+ }
+}