summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/stc/ccommon.h7
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