diff options
| author | Tyge Løvset <[email protected]> | 2020-08-30 23:18:29 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-08-30 23:18:29 +0200 |
| commit | 83a648c1ea1ed71b767779ac604833bc2f4ef200 (patch) | |
| tree | c2b8d96eea2e5a5026079bbe4f59ba9ac7912ab0 | |
| parent | a6406a9cdf24131fff267ead9f3f4e445033656c (diff) | |
| download | STC-modified-83a648c1ea1ed71b767779ac604833bc2f4ef200.tar.gz STC-modified-83a648c1ea1ed71b767779ac604833bc2f4ef200.zip | |
Added return iterators to clist_insert_after() and clist_erase_after(), conforming with std::forward_list.
| -rw-r--r-- | stc/clist.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/stc/clist.h b/stc/clist.h index 2dfbb2ac..153da566 100644 --- a/stc/clist.h +++ b/stc/clist.h @@ -115,13 +115,13 @@ clist_##tag##_push_n(clist_##tag *self, const clist_##tag##_input_t in[], size_t size); \
STC_API void \
clist_##tag##_pop_front(clist_##tag* self); \
- STC_API void \
+ STC_API clist_##tag##_iter_t \
clist_##tag##_insert_after_v(clist_##tag* self, clist_##tag##_iter_t pos, Value value); \
- STC_INLINE void \
+ STC_INLINE clist_##tag##_iter_t \
clist_##tag##_insert_after(clist_##tag* self, clist_##tag##_iter_t pos, RawValue rawValue) { \
- clist_##tag##_insert_after_v(self, pos, valueFromRaw(rawValue)); \
+ return clist_##tag##_insert_after_v(self, pos, valueFromRaw(rawValue)); \
} \
- STC_API void \
+ STC_API clist_##tag##_iter_t \
clist_##tag##_erase_after(clist_##tag* self, clist_##tag##_iter_t pos); \
STC_API void \
clist_##tag##_splice_front(clist_##tag* self, clist_##tag* other); \
@@ -189,14 +189,16 @@ _clist_erase_after(self, tag, self->last, valueDestroy); \
} \
\
- STC_API void \
+ STC_API clist_##tag##_iter_t \
clist_##tag##_insert_after_v(clist_##tag* self, clist_##tag##_iter_t pos, Value value) { \
_clist_insert_after(self, tag, pos.item, value); \
if (!self->last || pos.item == self->last) self->last = entry; \
+ pos.item = entry; return pos; \
} \
- STC_API void \
+ STC_API clist_##tag##_iter_t \
clist_##tag##_erase_after(clist_##tag* self, clist_##tag##_iter_t pos) { \
_clist_erase_after(self, tag, pos.item, valueDestroy); \
+ clist_##tag##_next(&pos); return pos; \
} \
\
STC_API void \
|
