diff options
Diffstat (limited to 'docs/csset_api.md')
| -rw-r--r-- | docs/csset_api.md | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/docs/csset_api.md b/docs/csset_api.md index e83ab857..21e38f61 100644 --- a/docs/csset_api.md +++ b/docs/csset_api.md @@ -8,18 +8,17 @@ See the c++ class [std::set](https://en.cppreference.com/w/cpp/container/set) fo ## Header file and declaration ```c -#define i_type // full typename of the container -#define i_key // key: REQUIRED -#define i_cmp // three-way compare two i_keyraw* : REQUIRED IF i_keyraw is a non-integral type -#define i_keydrop // destroy key func - defaults to empty destruct -#define i_keyclone // REQUIRED IF i_keydrop defined - -#define i_keyraw // convertion "raw" type - defaults to i_key -#define i_keyfrom // convertion func i_keyraw => i_key - defaults to plain copy -#define i_keyto // convertion func i_key* => i_keyraw - defaults to plain copy - -#define i_tag // alternative typename: csset_{i_tag}. i_tag defaults to i_val -#define i_ssize // defaults to int32_t +#define i_key <t> // element type: REQUIRED. Note: i_val* may be specified instead of i_key*. +#define i_type <t> // container type name +#define i_cmp <f> // three-way compare two i_keyraw* : REQUIRED IF i_keyraw is a non-integral type +#define i_keydrop <f> // destroy key func - defaults to empty destruct +#define i_keyclone <f> // REQUIRED IF i_keydrop defined + +#define i_keyraw <t> // convertion "raw" type - defaults to i_key +#define i_keyfrom <f> // convertion func i_keyraw => i_key - defaults to plain copy +#define i_keyto <f> // convertion func i_key* => i_keyraw - defaults to plain copy + +#define i_tag <s> // alternative typename: csset_{i_tag}. i_tag defaults to i_key #include <stc/csset.h> ``` `X` should be replaced by the value of `i_tag` in all of the following documentation. @@ -77,17 +76,18 @@ csset_X_value csset_X_value_clone(csset_X_value val); ## Example ```c +#define i_implement #include <stc/cstr.h> #define i_type SSet #define i_key_str #include <stc/csset.h> -int main () +int main(void) { SSet second={0}, third={0}, fourth={0}, fifth={0}; - second = c_make(SSet, {"red", "green", "blue"}); + second = c_init(SSet, {"red", "green", "blue"}); c_forlist (i, const char*, {"orange", "pink", "yellow"}) SSet_emplace(&third, *i.ref); |
