summaryrefslogtreecommitdiffhomepage
path: root/include/stc/clist.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-24 13:17:12 +0100
committerTyge Løvset <[email protected]>2023-02-24 13:17:12 +0100
commit560b1f4e4bf61ca01c27f1895b5138f6004eb717 (patch)
treeb8f0c4dba891b49c089a9a1916b75a002818f697 /include/stc/clist.h
parent5c66bfeb3bf39774ebd14444bd23eaa2c17447d0 (diff)
downloadSTC-modified-560b1f4e4bf61ca01c27f1895b5138f6004eb717.tar.gz
STC-modified-560b1f4e4bf61ca01c27f1895b5138f6004eb717.zip
Added eq function to cdeq, clist, cmap, csmap, and fixed cmap eq.
Diffstat (limited to 'include/stc/clist.h')
-rw-r--r--include/stc/clist.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/stc/clist.h b/include/stc/clist.h
index 6fd7252d..1650714b 100644
--- a/include/stc/clist.h
+++ b/include/stc/clist.h
@@ -205,6 +205,16 @@ STC_INLINE _cx_value*
_cx_memb(_get_mut)(_cx_self* self, _cx_raw val) {
return _cx_memb(_find_in)(_cx_memb(_begin)(self), _cx_memb(_end)(self), val).ref;
}
+
+STC_INLINE bool
+_cx_memb(_eq)(const _cx_self* v1, const _cx_self* v2) {
+ _cx_iter i1 = _cx_memb(_begin)(v1), i2 = _cx_memb(_begin)(v2);
+ for (; i1.ref && i2.ref; _cx_memb(_next)(&i1), _cx_memb(_next)(&i2)) {
+ const _cx_raw rx = i_keyto(i1.ref), ry = i_keyto(i2.ref);
+ if (!(i_eq((&rx), (&ry)))) return false;
+ }
+ return !(i1.ref || i2.ref);
+}
#endif
#ifndef i_no_cmp