diff options
| author | Tyge Løvset <[email protected]> | 2022-09-27 13:01:41 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-09-27 13:01:41 +0200 |
| commit | e433a1fc67500ab6bc03c302c01304fd45c72d0e (patch) | |
| tree | 135a508dbb6318c0c4a7650eb3a8d69c178dc87f /include/stc | |
| parent | 513300d52839e7e493bd296ba9786a018ce9dbd8 (diff) | |
| download | STC-modified-e433a1fc67500ab6bc03c302c01304fd45c72d0e.tar.gz STC-modified-e433a1fc67500ab6bc03c302c01304fd45c72d0e.zip | |
Added index, count vars to c_erase_if() + improved docs.
Diffstat (limited to 'include/stc')
| -rw-r--r-- | include/stc/ccommon.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index c6ec4529..2e84633c 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -280,10 +280,13 @@ STC_INLINE void crange_next(crange_iter* it) } while (0) #define c_erase_if(it, C, cnt, pred) do { \ + size_t index = 0, count = 0; \ C##_iter it = C##_begin(&cnt); \ - while (it.ref) \ - if (pred) it = C##_erase_at(&cnt, it); \ + while (it.ref) { \ + if (pred) it = C##_erase_at(&cnt, it), ++count; \ else C##_next(&it); \ + ++index; \ + } \ } while (0) #endif // CCOMMON_H_INCLUDED |
