summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/list_erase.c
diff options
context:
space:
mode:
authortylov <[email protected]>2023-07-20 15:09:10 +0200
committertylov <[email protected]>2023-07-20 15:12:29 +0200
commit900295256d825fc323149cd223c49787f32a3696 (patch)
tree6c79cf4209e3975bb6865e2940b9cb56ea469c73 /misc/examples/list_erase.c
parent224a04f7fa7549ed94d2a1415eb25829e39a7cca (diff)
downloadSTC-modified-900295256d825fc323149cd223c49787f32a3696.tar.gz
STC-modified-900295256d825fc323149cd223c49787f32a3696.zip
Moved examples to sub-directories. Added cotask1.c cotask2.c examples.
Diffstat (limited to 'misc/examples/list_erase.c')
-rw-r--r--misc/examples/list_erase.c30
1 files changed, 0 insertions, 30 deletions
diff --git a/misc/examples/list_erase.c b/misc/examples/list_erase.c
deleted file mode 100644
index 211c5a5d..00000000
--- a/misc/examples/list_erase.c
+++ /dev/null
@@ -1,30 +0,0 @@
-// erasing from clist
-#include <stdio.h>
-
-#define i_type IList
-#define i_key int
-#include <stc/clist.h>
-
-int main(void)
-{
- IList L = c_init(IList, {10, 20, 30, 40, 50});
-
- c_foreach (x, IList, L)
- printf("%d ", *x.ref);
- puts("");
- // 10 20 30 40 50
- IList_iter it = IList_begin(&L); // ^
- IList_next(&it);
- it = IList_erase_at(&L, it); // 10 30 40 50
- // ^
- IList_iter end = IList_end(&L); //
- IList_next(&it);
- it = IList_erase_range(&L, it, end); // 10 30
- // ^
- printf("list contains:");
- c_foreach (x, IList, L)
- printf(" %d", *x.ref);
- puts("");
-
- IList_drop(&L);
-}