summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/sso_map.c
blob: cc5e16a1cc55d183f03de09e3ff0d2362a3f17e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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");
    }
}