diff options
| author | Tyge Løvset <[email protected]> | 2022-08-09 17:34:13 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-08-09 17:34:13 +0200 |
| commit | 90624d6d398ff1d0f79df3dd656c4ad0c9c498a9 (patch) | |
| tree | 8e45f6d00189a261c6a54979010f634df2af0d49 /include/stc/cstack.h | |
| parent | 17f1d2ed83952df00525f4be1d30a6c12e04a0f6 (diff) | |
| download | STC-modified-90624d6d398ff1d0f79df3dd656c4ad0c9c498a9.tar.gz STC-modified-90624d6d398ff1d0f79df3dd656c4ad0c9c498a9.zip | |
Experiment with other type of iterator. Does not compile.
Diffstat (limited to 'include/stc/cstack.h')
| -rw-r--r-- | include/stc/cstack.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/stc/cstack.h b/include/stc/cstack.h index 46d209ca..3986e366 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -170,12 +170,12 @@ STC_INLINE i_keyraw _cx_memb(_value_toraw)(const _cx_value* val) #endif // !_i_no_clone STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) - { return c_make(_cx_iter){(_cx_value*)self->data}; } + { return c_make(_cx_iter){self->size ? (_cx_value*)self->data : NULL, (_cx_value*)self->data + self->size}; } STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self) - { return c_make(_cx_iter){(_cx_value*)self->data + self->size}; } + { return c_make(_cx_iter){NULL}; } -STC_INLINE void _cx_memb(_next)(_cx_iter* it) { ++it->ref; } +STC_INLINE void _cx_memb(_next)(_cx_iter* it) { if (++it->ref == it->_end) it->ref = NULL; } STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, intptr_t offs) { it.ref += offs; return it; } |
