From 5c66bfeb3bf39774ebd14444bd23eaa2c17447d0 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Fri, 24 Feb 2023 11:58:05 +0100 Subject: Added eq function to cvec. --- include/stc/cvec.h | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- cgit v1.2.3