diff options
| author | Tyge Løvset <[email protected]> | 2020-07-14 12:13:59 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-07-14 12:16:08 +0200 |
| commit | d321570097ef5abeb86d3fe005e0da7b4ba28408 (patch) | |
| tree | 1ccc32404cdd73b4f4df046604cfcdcaefde9d06 | |
| parent | df4f9c6aa33fd5f33ed09ad4f698a548b4f913b9 (diff) | |
| download | STC-modified-d321570097ef5abeb86d3fe005e0da7b4ba28408.tar.gz STC-modified-d321570097ef5abeb86d3fe005e0da7b4ba28408.zip | |
Updated declare_CHash call.
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | stc/chash.h | 2 |
2 files changed, 3 insertions, 3 deletions
@@ -103,7 +103,7 @@ CHash and CVector discussion You may customize the destroy-, hash- and equals- function. It also supports a few other arguments in the declare-statement that allows to define a convertion from a raw/literal type to the key-type specified. This is handy when e.g. having CString as key, as it enables the usage of string literals as key in *put() and *get() functions, instead of requering a constructed CString. Without it, you would have to write:
```
-declare_CHash(si, MAP, CString, int);
+declare_CHash(si, CString, int);
...
chash_si_put(&map, cstring_make("mykey"), 12);
```
@@ -115,7 +115,7 @@ cstring_destroy(&lookup); ```
To avoid this, use *declare_CHash_string()*:
```
-declare_CHash_string(si, MAP, int);
+declare_CHash_string(si, int);
...
CHash_si map = chash_init;
chash_si_put(&map, "mykey", 12); // constructs a CString key from the const char* internally.
diff --git a/stc/chash.h b/stc/chash.h index 1518d1dc..870d6ae4 100644 --- a/stc/chash.h +++ b/stc/chash.h @@ -23,7 +23,7 @@ /* // Example:
#include <stdio.h>
-#include <stc/cmap.h>
+#include <stc/chash.h>
declare_CHash(sx, int); // Set of int
declare_CHash(mx, int, char); // Map of int -> char
|
