From c54da07eb171455ad182d61a1fb5c4e4520aebbb Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Thu, 18 May 2023 15:39:48 +0200 Subject: Fixing find_in() in cdeq, and add support c_eraseremove_if() for cqueue and cdeq. --- include/stc/cstack.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/stc/cstack.h') diff --git a/include/stc/cstack.h b/include/stc/cstack.h index 87ef9405..84bdb41b 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -80,6 +80,7 @@ STC_INLINE void _cx_memb(_drop)(_cx_self* self) { i_free(self->data); #endif } + STC_INLINE intptr_t _cx_memb(_size)(const _cx_self* self) { return self->_len; } @@ -187,4 +188,10 @@ STC_INLINE void _cx_memb(_next)(_cx_iter* it) STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, size_t n) { if ((it.ref += n) >= it.end) it.ref = NULL ; return it; } +STC_INLINE intptr_t _cx_memb(_index)(const _cx_self* self, _cx_iter it) + { return (it.ref - self->data); } + +STC_INLINE void _cx_memb(_adjust_end_)(_cx_self* self, intptr_t n) + { self->_len += n; } + #include "priv/template2.h" -- cgit v1.2.3