summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cmap.h
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2023-03-31 22:08:07 +0200
committerTyge Lovset <[email protected]>2023-03-31 22:08:07 +0200
commit5693ae9ae0d1a18627ba540e0240da010b282296 (patch)
treeccb0dbe519d9a27fc944446ecc1a574cd9d86fcc /include/stc/cmap.h
parent56c394ede691143a32d53f4094df37dc49dc0a29 (diff)
downloadSTC-modified-5693ae9ae0d1a18627ba540e0240da010b282296.tar.gz
STC-modified-5693ae9ae0d1a18627ba540e0240da010b282296.zip
Added stc/extend.h: A generalized way to type-safely extend a container with new members which can be accessed from the template parameters. See examples/functor.c
Diffstat (limited to 'include/stc/cmap.h')
-rw-r--r--include/stc/cmap.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/stc/cmap.h b/include/stc/cmap.h
index c840523f..437a5982 100644
--- a/include/stc/cmap.h
+++ b/include/stc/cmap.h
@@ -82,7 +82,7 @@ typedef struct { int64_t idx; uint8_t hx; } chash_bucket_t;
#define _i_size i_ssize
#endif
#include "priv/template.h"
-#if !c_option(c_is_forward)
+#ifndef i_is_forward
_cx_deftypes(_c_chash_types, _cx_self, i_key, i_val, i_ssize, _i_MAP_ONLY, _i_SET_ONLY);
#endif
@@ -277,11 +277,11 @@ _cx_memb(_erase_at)(_cx_self* self, _cx_iter it) {
}
STC_INLINE bool
-_cx_memb(_eq)(const _cx_self* m1, const _cx_self* m2) {
- if (_cx_memb(_size)(m1) != _cx_memb(_size)(m2)) return false;
- for (_cx_iter i = _cx_memb(_begin)(m1); i.ref; _cx_memb(_next)(&i)) {
+_cx_memb(_eq)(const _cx_self* self, const _cx_self* other) {
+ if (_cx_memb(_size)(self) != _cx_memb(_size)(other)) return false;
+ for (_cx_iter i = _cx_memb(_begin)(self); i.ref; _cx_memb(_next)(&i)) {
const _cx_rawkey _raw = i_keyto(_i_keyref(i.ref));
- if (!_cx_memb(_contains)(m2, _raw)) return false;
+ if (!_cx_memb(_contains)(other, _raw)) return false;
}
return true;
}