diff options
| author | Tyge Løvset <[email protected]> | 2021-12-02 14:39:42 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-12-02 14:39:42 +0100 |
| commit | 323f21d57aaf30ffd43d6b67146bc887ad206298 (patch) | |
| tree | 3e4045251b0a0d0fb55e152ce728da6b5a3e875b /docs/cmap_api.md | |
| parent | f857d8215a266673e25356779f740100fe362025 (diff) | |
| download | STC-modified-323f21d57aaf30ffd43d6b67146bc887ad206298.tar.gz STC-modified-323f21d57aaf30ffd43d6b67146bc887ad206298.zip | |
Breaking changes for i_fwd and i_cmp_none:
- Removed: i_cmp_none and i_fwd (replaced by c_no_compare and c_is_fwd args to i_opt).
- Added compile-time disabling of clonable and comparable container elements, controlled by i_opt (c_no_clone | c_no_compare)
- Added i_opt: can define multiple compile-time options: c_no_compare, c_no_clone, c_no_atomic, c_is_fwd: may be combined with | separator.
- Except for csptr, when i_del / i_valdel / i_keydel is defined, also i_from / i_keyfrom / i_valfrom must be defined or i_opt c_no_clone.
- For struct elements, either i_cmp must be defined (as before), or define i_opt c_no_compare for non-associative containers.
Diffstat (limited to 'docs/cmap_api.md')
| -rw-r--r-- | docs/cmap_api.md | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/docs/cmap_api.md b/docs/cmap_api.md index a33dc5c0..e4bc266a 100644 --- a/docs/cmap_api.md +++ b/docs/cmap_api.md @@ -80,22 +80,18 @@ cmap_X_rawvalue cmap_X_value_toraw(cmap_X_value* pval); ``` Helpers: ```c -uint64_t c_strhash(const char *str); // utility function - -int c_rawstr_compare(const char* const* a, const char* const* b); -bool c_rawstr_equalto(const char* const* a, const char* const* b); -uint64_t c_rawstr_hash(const char* const* strp, ...); - -uint64_t c_default_hash(const void *data, size_t len); // key is any integral type -uint64_t c_hash32(const void* data, size_t is4); // key is one 32-bit int -uint64_t c_hash64(const void* data, size_t is8); // key is one 64-bit int -bool c_default_equalto(const i_keyraw* a, const i_keyraw* b); // the == operator -bool c_memcmp_equalto(const i_keyraw* a, const i_keyraw* b); // uses memcmp - -Type c_no_clone(Type val); -Type c_default_fromraw(Type val); // plain copy -Type c_default_toraw(Type* val); -void c_default_del(Type* val); // does nothing +uint64_t c_strhash(const char *str); // utility function + +// hash template parameter functions: +uint64_t c_default_hash(const void *data, size_t len); // key is any integral type +uint64_t c_hash32(const void* data, size_t is4); // key is one 32-bit int +uint64_t c_hash64(const void* data, size_t is8); // key is one 64-bit int +uint64_t c_rawstr_hash(const char* const* strp, size_t unused); + +// equalto template parameter functions: +bool c_default_equalto(const i_keyraw* a, const i_keyraw* b); // *a == *b +bool c_memcmp_equalto(const i_keyraw* a, const i_keyraw* b); // !memcmp(a, b, sizeof *a) +bool c_rawstr_equalto(const char* const* a, const char* const* b); // !strcmp(*a, *b) ``` ## Types |
