diff options
| author | _Tradam <[email protected]> | 2023-09-08 01:29:47 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-08 01:29:47 +0000 |
| commit | 3c76c7f3d5db3f9586a90d03f8fbb02d79de9acd (patch) | |
| tree | afbe4b540967223911f7c5de36559b82154f02f3 /misc/examples/strings/sso_map.c | |
| parent | 0841165881871ee01b782129be681209aeed2423 (diff) | |
| parent | 1a72205fe05c2375cfd380dd8381a8460d9ed8d1 (diff) | |
| download | STC-modified-modified.tar.gz STC-modified-modified.zip | |
Diffstat (limited to 'misc/examples/strings/sso_map.c')
| -rw-r--r-- | misc/examples/strings/sso_map.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/misc/examples/strings/sso_map.c b/misc/examples/strings/sso_map.c new file mode 100644 index 00000000..4f84b651 --- /dev/null +++ b/misc/examples/strings/sso_map.c @@ -0,0 +1,19 @@ +#define i_implement +#include <stc/cstr.h> +#define i_key_str +#define i_val_str +#include <stc/cmap.h> + +int main(void) +{ + cmap_str m = {0}; + 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_ZI ", Is long: %s\n", + cstr_str(_.k), cstr_str(_.v), cstr_size(_.v), + cstr_is_long(_.v) ? "true" : "false"); + + cmap_str_drop(&m); +} |
