summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-12-20 19:52:51 +0100
committerTyge Løvset <[email protected]>2021-12-20 19:52:51 +0100
commite38e9164d816bf1ee1f1dcc40f69ac158562fb1a (patch)
tree23bbec187b488730964ab538d401ded9ab319169 /examples
parent0c3d711c2541aebe9a44fecb732e096bed14f72c (diff)
downloadSTC-modified-e38e9164d816bf1ee1f1dcc40f69ac158562fb1a.tar.gz
STC-modified-e38e9164d816bf1ee1f1dcc40f69ac158562fb1a.zip
Some small addition to constness in API. Updated docs.
Diffstat (limited to 'examples')
-rw-r--r--examples/vikings.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/vikings.c b/examples/vikings.c
index c4e86c73..7a953059 100644
--- a/examples/vikings.c
+++ b/examples/vikings.c
@@ -39,11 +39,11 @@ static inline RViking Viking_toraw(const Viking* vk) {
#define i_keyraw RViking
#define i_val int
// i_key_bind auto-binds these functions:
-// #define i_hash Viking_hash
-// #define i_eq Viking_eq
-// #define i_keyfrom Viking_from // uses _from (not _clone) because i_keyraw is defined
-// #define i_keyto Viking_toraw
-// #define i_keydrop Viking_drop
+// i_hash => Viking_hash
+// i_eq => Viking_eq
+// i_keyfrom => Viking_from // not _clone because i_keyraw is defined
+// i_keyto => Viking_toraw
+// i_keydrop => Viking_drop
#include <stc/cmap.h>
int main()
@@ -58,8 +58,8 @@ int main()
Vikings_emplace_or_assign(&vikings, bjorn, 10);
RViking einar = {"Einar", "Norway"};
- Vikings_value *e = Vikings_find(&vikings, einar).ref;
- e->second += 3; // add 3 hp points to Einar
+ Vikings_value* v = Vikings_get_mut(&vikings, einar);
+ v->second += 3; // add 3 hp points to Einar
Vikings_emplace(&vikings, einar, 0).ref->second += 5; // add 5 more to Einar
c_forpair (viking, hp, Vikings, vikings) {