diff options
| author | Tyge Løvset <[email protected]> | 2021-09-23 20:55:07 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-09-23 20:55:07 +0200 |
| commit | 2686887e9091b3d56365b8ddc15db67324ee6727 (patch) | |
| tree | 48e634d4eaebb7c67e3816f4110a150343f9c366 /docs/clist_api.md | |
| parent | 4ab5b3f6f5c841ab8c2202e838979a0d6df91530 (diff) | |
| download | STC-modified-2686887e9091b3d56365b8ddc15db67324ee6727.tar.gz STC-modified-2686887e9091b3d56365b8ddc15db67324ee6727.zip | |
Cleanup: Replaced c_emplace() macro with more general c_apply()/c_apply_pair() macros, and removed c_var() macro.
Removed CX_emplace_items() member functions in containers used by c_emplace().
Diffstat (limited to 'docs/clist_api.md')
| -rw-r--r-- | docs/clist_api.md | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/docs/clist_api.md b/docs/clist_api.md index d6be8bfc..e1b8f0b1 100644 --- a/docs/clist_api.md +++ b/docs/clist_api.md @@ -56,7 +56,6 @@ void clist_X_pop_front(clist_X* self); void clist_X_push_back(clist_X* self, i_val value); // note: no pop_back(). void clist_X_emplace_back(clist_X* self, i_valraw raw); -void clist_X_emplace_items(clist_X *self, const clist_X_rawvalue_t arr[], size_t n); clist_X_iter_t clist_X_insert(clist_X* self, clist_X_iter_t it, i_val value); // return iter to new elem clist_X_iter_t clist_X_emplace(clist_X* self, clist_X_iter_t it, i_valraw raw); @@ -103,7 +102,8 @@ Interleave *push_front()* / *push_back()* then *sort()*: #include <stdio.h> int main() { - c_var (clist_d, list, { + clist_d list = clist_d_init(); + c_apply(clist_d, push_back, &list, { 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0 }); @@ -143,7 +143,8 @@ Use of *erase_at()* and *erase_range()*: int main () { - c_var (clist_i, L, {10, 20, 30, 40, 50}); + clist_i L = clist_i_init(); + c_apply(clist_i, push_back, &L, {10, 20, 30, 40, 50}); // 10 20 30 40 50 clist_i_iter_t it = clist_i_begin(&L); // ^ clist_i_next(&it); @@ -178,8 +179,8 @@ Splice `[30, 40]` from *L2* into *L1* before `3`: int main() { c_auto (clist_i, L1, L2) { - c_emplace(clist_i, L1, {1, 2, 3, 4, 5}); - c_emplace(clist_i, L2, {10, 20, 30, 40, 50}); + c_apply(clist_i, push_back, &L1, {1, 2, 3, 4, 5}); + c_apply(clist_i, push_back, &L2, {10, 20, 30, 40, 50}); clist_i_iter_t i = clist_i_advance(clist_i_begin(&L1), 2); clist_i_iter_t j1 = clist_i_advance(clist_i_begin(&L2), 2), j2 = clist_i_advance(j1, 2); |
