summaryrefslogtreecommitdiffhomepage
path: root/docs/clist_api.md
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-05-22 20:52:18 +0200
committerTyge Løvset <[email protected]>2022-05-22 20:52:18 +0200
commit1c3e7b683469904d224f3f8f1ee0096f1c5b1b9d (patch)
tree826ca6560cd952996eb9793cb3356a9791753f2e /docs/clist_api.md
parent314a41be6b39b6c5967d79555dbf018dbc7eb5f6 (diff)
downloadSTC-modified-1c3e7b683469904d224f3f8f1ee0096f1c5b1b9d.tar.gz
STC-modified-1c3e7b683469904d224f3f8f1ee0096f1c5b1b9d.zip
Changed c_apply(v, ..) macro to make it more consistent with c_apply_arr(v, ..) and c_foreach (i, ..): v changed to a pointer - not value.
Note: also c_pair(v) is changed correspondingly, so usage with c_apply(v) is unchanged.
Diffstat (limited to 'docs/clist_api.md')
-rw-r--r--docs/clist_api.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/clist_api.md b/docs/clist_api.md
index 5dd5d524..58970a19 100644
--- a/docs/clist_api.md
+++ b/docs/clist_api.md
@@ -109,7 +109,7 @@ Interleave *push_front()* / *push_back()* then *sort()*:
int main() {
clist_d list = clist_d_init();
- c_apply(v, clist_d_push_back(&list, v), double, {
+ c_apply(v, clist_d_push_back(&list, *v), double, {
10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0
});
@@ -150,7 +150,7 @@ Use of *erase_at()* and *erase_range()*:
int main ()
{
clist_i L = clist_i_init();
- c_apply(v, clist_i_push_back(&L, v), int, {10, 20, 30, 40, 50});
+ c_apply(v, clist_i_push_back(&L, *v), int, {10, 20, 30, 40, 50});
// 10 20 30 40 50
clist_i_iter it = clist_i_begin(&L); // ^
clist_i_next(&it);
@@ -185,8 +185,8 @@ Splice `[30, 40]` from *L2* into *L1* before `3`:
int main() {
c_auto (clist_i, L1, L2)
{
- c_apply(v, clist_i_push_back(&L1, v), int, {1, 2, 3, 4, 5});
- c_apply(v, clist_i_push_back(&L2, v), int, {10, 20, 30, 40, 50});
+ c_apply(v, clist_i_push_back(&L1, *v), int, {1, 2, 3, 4, 5});
+ c_apply(v, clist_i_push_back(&L2, *v), int, {10, 20, 30, 40, 50});
clist_i_iter i = clist_i_advance(clist_i_begin(&L1), 2);
clist_i_iter j1 = clist_i_advance(clist_i_begin(&L2), 2), j2 = clist_i_advance(j1, 2);