summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-12-08 23:11:26 +0100
committerGitHub <[email protected]>2020-12-08 23:11:26 +0100
commit8c9d0c640c19d6325f1c53918da64831c9ae2669 (patch)
tree4531f037706de91c7834add72821b6735321930e /docs
parent2bd35118cf5c040444eecfff2e9b37df8922811a (diff)
downloadSTC-modified-8c9d0c640c19d6325f1c53918da64831c9ae2669.tar.gz
STC-modified-8c9d0c640c19d6325f1c53918da64831c9ae2669.zip
Update cptr_api.md. Simplified example.
Diffstat (limited to 'docs')
-rw-r--r--docs/cptr_api.md9
1 files changed, 4 insertions, 5 deletions
diff --git a/docs/cptr_api.md b/docs/cptr_api.md
index 52518c3c..ee4b8aa7 100644
--- a/docs/cptr_api.md
+++ b/docs/cptr_api.md
@@ -84,10 +84,9 @@ using_cmap(ps, int, csptr_ps, csptr_ps_del);
int main() {
cmap_ps map = cmap_inits;
- c_forrange (i, 20)
- c_try_emplace(&map, cmap_ps, (i * 7) % 10,
- csptr_ps_from(Person_from(c_new(Person), cstr_from_fmt("Name %d", (i * 7) % 10),
- cstr_from_fmt("Last %d", (i * 9) % 10))));
+ cmap_ps_emplace(&map, 1990, csptr_ps_from(Person_from(c_new(Person), cstr_from("Joe"), cstr_from("Average"));
+ cmap_ps_emplace(&map, 1985, csptr_ps_from(Person_from(c_new(Person), cstr_from("John"), cstr_from("Smith"));
+
c_foreach (i, cmap_ps, map)
printf(" %d: %s\n", i.val->first, i.val->second.get->name.str);
cmap_ps_del(&map);
@@ -96,4 +95,4 @@ int main() {
Output:
```
top: 81
-``` \ No newline at end of file
+```