From 894e19c84518e4c679bc96e4653b95a5c9c0e12f Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sun, 17 Jan 2021 09:53:26 +0100 Subject: Fixed code so that it runs in STC_HEADER mode. csmap.h slightly simplified. --- examples/csmap_ex.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/csmap_ex.c b/examples/csmap_ex.c index b750aa82..3d66ec2a 100644 --- a/examples/csmap_ex.c +++ b/examples/csmap_ex.c @@ -7,6 +7,7 @@ //using_csmap(s, cstr, cstr, cstr_del, cstr_clone, cstr_compare_ref, cstr_del, cstr_clone); using_csmap(i, int, int); +using_csset_str(); #include @@ -38,8 +39,17 @@ int main(int argc, char **argv) c_foreach (i, csmap_i, it, csmap_i_end(&map)) printf("-- %d: %d\n", i.ref->first, i.ref->second); + printf("\n%d: %d\n", 500000, *csmap_i_at(&map, 500000)); csmap_i_del(&map); - puts("done"); + puts("done\n"); + + + c_init (csset_str, names, { + "Hello", "Try this", "Awesome", "Works well", "Greetings" + }); + c_foreach (i, csset_str, names) + printf("name: %s\n", i.ref->str); + return 0; } -- cgit v1.2.3