diff options
| author | Tyge Løvset <[email protected]> | 2020-09-15 22:43:41 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-09-15 22:43:41 +0200 |
| commit | f4435af2fc9e9187f7be0149c2eb916db27cb257 (patch) | |
| tree | 117429619290d165b7a3001f21f3c0e7f37a1045 /examples/advanced.c | |
| parent | f539099575e14aea9f2e043b9af33d05c47399ad (diff) | |
| download | STC-modified-f4435af2fc9e9187f7be0149c2eb916db27cb257.tar.gz STC-modified-f4435af2fc9e9187f7be0149c2eb916db27cb257.zip | |
New API Change.
Diffstat (limited to 'examples/advanced.c')
| -rw-r--r-- | examples/advanced.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/advanced.c b/examples/advanced.c index fe46f5da..ab2cec5f 100644 --- a/examples/advanced.c +++ b/examples/advanced.c @@ -47,11 +47,11 @@ VikingVw viking_toVw(Viking* vk) { VikingVw vw = {vk->name.str, vk->country.str}; return vw; } Viking viking_fromVw(VikingVw vw) { - Viking vk = {cstr_make(vw.name), cstr_make(vw.country)}; return vk; + Viking vk = {cstr(vw.name), cstr(vw.country)}; return vk; } -// Using the full declare_cmap() macro to define [Viking -> int] hash map type: -declare_cmap(vk, Viking, int, c_default_destroy, vikingvw_equals, vikingvw_hash, +// Using the full cdef_cmap() macro to define [Viking -> int] hash map type: +cdef_cmap(vk, Viking, int, c_default_destroy, vikingvw_equals, vikingvw_hash, viking_destroy, VikingVw, viking_toVw, viking_fromVw); // cmap_vk uses vikingvw_hash() for hash value calculations, and vikingvw_equals() for equality test. @@ -74,7 +74,7 @@ int main() cmap_vk_emplace(&vikings, einar, 0).first->value += 5; // again c_foreach (k, cmap_vk, vikings) { - printf("%s of %s has %d hp\n", k.item->key.name.str, k.item->key.country.str, k.item->value); + printf("%s of %s has %d hp\n", k.get->key.name.str, k.get->key.country.str, k.get->value); } cmap_vk_destroy(&vikings); } |
