summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-24 11:58:05 +0100
committerTyge Løvset <[email protected]>2023-02-24 11:58:05 +0100
commit5c66bfeb3bf39774ebd14444bd23eaa2c17447d0 (patch)
tree2f9ad3b24c4f98c20bac728830911e2c2b1e28f8 /include
parent84e75e1b5039c3e04d9683ec7d8302f1a824b5cb (diff)
downloadSTC-modified-5c66bfeb3bf39774ebd14444bd23eaa2c17447d0.tar.gz
STC-modified-5c66bfeb3bf39774ebd14444bd23eaa2c17447d0.zip
Added eq function to cvec.
Diffstat (limited to 'include')
-rw-r--r--include/stc/cvec.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index 8d5a5c87..130644cf 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -233,6 +233,13 @@ STC_INLINE _cx_value*
_cx_memb(_get_mut)(const _cx_self* self, _cx_raw raw)
{ return (_cx_value*) _cx_memb(_get)(self, raw); }
+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))
+ if (!i_eq(i1.ref, i2.ref)) return false;
+ return !(i1.ref || i2.ref);
+}
#endif
#ifndef i_no_cmp