summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-01-12 20:42:57 +0100
committerTyge Løvset <[email protected]>2021-01-12 20:42:57 +0100
commitb41fe24b6c2e60265152ec618aa7cc806d9435d1 (patch)
tree9dc48d24bf251aaa167929e4c14c1a28cf783415 /docs
parent7e6afad9f4aa2e0ca4161808d93e2e9d20cb7c07 (diff)
parentf9c6df36d5811545bf9adfc12c82ccbae456a9ac (diff)
downloadSTC-modified-b41fe24b6c2e60265152ec618aa7cc806d9435d1.tar.gz
STC-modified-b41fe24b6c2e60265152ec618aa7cc806d9435d1.zip
Merge branch 'master' of https://github.com/tylo-work/C99Containers into master
Diffstat (limited to 'docs')
-rw-r--r--docs/cmap_api.md15
-rw-r--r--docs/cset_api.md2
2 files changed, 6 insertions, 11 deletions
diff --git a/docs/cmap_api.md b/docs/cmap_api.md
index e45c75c6..8f83fc5d 100644
--- a/docs/cmap_api.md
+++ b/docs/cmap_api.md
@@ -178,8 +178,7 @@ using_cmap_strval(id, int);
int main()
{
uint32_t col = 0xcc7744ff;
- cmap_id idnames = cmap_inits;
- c_push_items(&idnames, cmap_id, {
+ c_init (cmap_id, idnames, {
{100, "Red"},
{110, "Blue"},
});
@@ -246,13 +245,11 @@ Inverse: demonstrate cmap with mapped POD type Vec3i: cmap<int, Vec3i>:
#include <stdio.h>
typedef struct { int x, y, z; } Vec3i;
-
using_cmap(iv, int, Vec3i);
int main()
{
cmap_iv vecs = cmap_iv_init();
-
cmap_iv_put(&vecs, 1, (Vec3i){100, 0, 0});
cmap_iv_put(&vecs, 2, (Vec3i){ 0, 100, 0});
cmap_iv_put(&vecs, 3, (Vec3i){ 0, 0, 100});
@@ -289,7 +286,6 @@ void viking_del(Viking* vk) {
cstr_del(&vk->country);
}
-
// Define Viking raw struct with hash, equals, and convertion functions between Viking and VikingRaw structs:
typedef struct VikingRaw {
@@ -321,11 +317,10 @@ using_cmap(vk, Viking, int, c_default_del, c_default_clone,
int main()
{
- cmap_vk vikings = cmap_vk_init();
- c_push_items(&vikings, cmap_vk, {
- { {"Einar", "Norway"}, 20},
- { {"Olaf", "Denmark"}, 24},
- { {"Harald", "Iceland"}, 12},
+ c_init (cmap_vk, vikings, {
+ { {"Einar", "Norway"}, 20 },
+ { {"Olaf", "Denmark"}, 24 },
+ { {"Harald", "Iceland"}, 12 },
});
cmap_vk_put(&vikings, (VikingRaw){"Bjorn", "Sweden"}, 10);
diff --git a/docs/cset_api.md b/docs/cset_api.md
index f8629aa8..faeca52f 100644
--- a/docs/cset_api.md
+++ b/docs/cset_api.md
@@ -109,7 +109,7 @@ int main ()
cset_str fifth = cset_str_clone(second);
c_foreach (i, cset_str, third)
- cset_str_emplace(&fifth, i.ref->ref);
+ cset_str_emplace(&fifth, i.ref->str);
c_foreach (i, cset_str, fourth)
cset_str_emplace(&fifth, i.ref->str);