diff options
| author | Tyge Løvset <[email protected]> | 2020-09-17 22:50:56 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-09-17 22:50:56 +0200 |
| commit | 19e8143e19f5650c70bea344b2e37f751f3f1cf0 (patch) | |
| tree | 645f116bba5cdbdd9ab510982eff6b7b938f7741 | |
| parent | ed605513da1d9b5686b57673f393c2d6ac8b2115 (diff) | |
| download | STC-modified-19e8143e19f5650c70bea344b2e37f751f3f1cf0.tar.gz STC-modified-19e8143e19f5650c70bea344b2e37f751f3f1cf0.zip | |
Update README.md
| -rw-r--r-- | README.md | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -115,11 +115,8 @@ cmap discussion ---------------
**cmap / cset** support managing memory of the elements, i.e., you may customize the destroy-, hash- and equals- function, in addition to convertion to from some literal input types. E.g. it enables the usage of string literals as key in functions, instead of requering a constructed cstr as input.
-```
-using_cmap_strkey(si, int); // cstr_t => int map. Uses a special instatiatiation for cstr that allows you to input string literals as key.
-...
-cmap_si_emplace(&map, "mykey", 12); // construct and assign cstr("mykey") inside function, only if not already exist.
-```
+
+
As string are common both as key and value, these are predefined:
- *using_cmap_strkey(tag, valuetype)* // *cstr_t* => *valuetype*
- *using_cmap_strval(tag, keytype)* // *keytype* => *cstr_t*
@@ -164,7 +161,7 @@ int main() { cstr_t full_path = cstr_from("%s/%s.%s", "directory", "filename", "ext");
printf("%s\n", full_path.str);
- cstr_mdestroy(&s1, &full_path);
+ cstr_dtor(cstr, &s1, &full_path); // multi-destroy..
}
```
**cvec** of *int64_t*.
@@ -199,12 +196,12 @@ int main() { cvec_str_emplace_back(&names, "Joe");
cstr_assign(&names.data[1], "Jake"); // replace "Joe".
- // Use puch_back() for arguments of type cstr_t: is moved to the map.
+ // Use push_back() for items of type cstr_t: is moved to the map.
cvec_str_push_back(&names, cstr_from("%d elements so far", cvec_size(names)));
printf("%s\n", names.data[1].str); // Access the string char*
c_foreach (i, cvec_str, names)
- printf("get %s\n", i.get->str);
+ printf("name: %s\n", i.get->str);
cvec_str_destroy(&names);
}
```
|
