summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-01-05 17:42:47 +0100
committerTyge Løvset <[email protected]>2021-01-05 17:42:47 +0100
commit0c5a4cd748f51591e4da42586164653f1a078f3e (patch)
tree4e30b8566fd49f72c055189a053a635ffb6611f4
parentf929b1ab7a9314cbdf8148a585cf3807dc247f4b (diff)
parente32d505e82fbf5e6fb4ae251fbf3c6d2ec49f9e3 (diff)
downloadSTC-modified-0c5a4cd748f51591e4da42586164653f1a078f3e.tar.gz
STC-modified-0c5a4cd748f51591e4da42586164653f1a078f3e.zip
Merge branch 'master' of https://github.com/tylo-work/C99Containers into master
-rw-r--r--docs/clist_api.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/clist_api.md b/docs/clist_api.md
index 7c5f78ee..deaec104 100644
--- a/docs/clist_api.md
+++ b/docs/clist_api.md
@@ -98,6 +98,22 @@ clist_X_value_t* clist_X_itval(clist_X_iter_t it);
clist_X_value_t clist_X_value_clone(clist_X_value_t val);
```
+The `clist_X_split_after(self, it1, it2)` can be combined with `clist_X_splice_after(self, pos, other)` to mimic c++ `std::forward_list::splice_after(pos, other, it1, it2)`. Note however, that `it2` is included in elements to be spliced, unlike with `std::forward_list()`. E.g, splice in 2, 3 after 10 in L2:
+```c
+c_init (clist_i, L1, {1, 2, 3, 4, 5});
+c_init (clist_i, L2, {10, 20, 30, 40, 50});
+
+clist_i_iter_t it = clist_i_fwd(clist_i_begin(&L1), 2);
+clist_i tmp = clist_i_split_after(&L1, clist_i_begin(&L1), it);
+clist_i_splice_after(&L2, clist_i_begin(&L2), &tmp);
+
+// C++:
+// auto it = L1.begin(); std::advance(it, 3);
+// L2.splice_after(L2.cbegin(), L1, L1.cbegin(), it);
+
+// L1: 1 4 5
+// L2: 10 2 3 20 30 40 50
+```
## Example
```c