From 0c6b41fd08bac55281ff9ad41b0d052171881651 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Tue, 26 Oct 2021 20:46:43 +0200 Subject: Added some examples and updated docs. Removed cvec_X_erase() and cdeq_X_erase() - may be used wrong. Use cvec_X_erase_n() instead. Fixed type-bug in cpque.h (same was in cqueue.h). --- include/stc/cdeq.h | 4 ---- include/stc/cpque.h | 2 +- include/stc/cvec.h | 5 +---- 3 files changed, 2 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h index 264761e0..160c7601 100644 --- a/include/stc/cdeq.h +++ b/include/stc/cdeq.h @@ -157,10 +157,6 @@ cx_memb(_emplace_range)(Self* self, cx_iter_t it, cx_iter_t it1, cx_iter_t it2) return cx_memb(_insert_range_p)(self, it.ref, it1.ref, it2.ref, true); } -STC_INLINE cx_iter_t -cx_memb(_erase)(Self* self, size_t idx) { - return cx_memb(_erase_range_p)(self, self->data + idx, self->data + idx + 1); -} STC_INLINE cx_iter_t cx_memb(_erase_n)(Self* self, size_t idx, size_t n) { return cx_memb(_erase_range_p)(self, self->data + idx, self->data + idx + n); diff --git a/include/stc/cpque.h b/include/stc/cpque.h index 0a06fc40..3fc8ebea 100644 --- a/include/stc/cpque.h +++ b/include/stc/cpque.h @@ -53,7 +53,7 @@ STC_INLINE Self cx_memb(_with_capacity)(size_t cap) { STC_INLINE void cx_memb(_reserve)(Self* self, size_t n) { if (n >= self->size) - self->data = (cx_value_t *)c_realloc(self->data, (self->capacity = n)*sizeof(cx_rawvalue_t)); + self->data = (cx_value_t *)c_realloc(self->data, (self->capacity = n)*sizeof(cx_value_t)); } STC_INLINE void cx_memb(_clear)(Self* self) { diff --git a/include/stc/cvec.h b/include/stc/cvec.h index ff5b4399..3810e678 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -172,10 +172,7 @@ STC_INLINE cx_iter_t cx_memb(_emplace_range)(Self* self, cx_iter_t it, cx_iter_t it1, cx_iter_t it2) { return cx_memb(_insert_range_p)(self, it.ref, it1.ref, it2.ref, true); } -STC_INLINE cx_iter_t -cx_memb(_erase)(Self* self, size_t idx) { - return cx_memb(_erase_range_p)(self, self->data + idx, self->data + idx + 1); -} + STC_INLINE cx_iter_t cx_memb(_erase_n)(Self* self, size_t idx, size_t n) { return cx_memb(_erase_range_p)(self, self->data + idx, self->data + idx + n); -- cgit v1.2.3