From 895ef5181d03a628d654aa8425aa05fa583f5bf9 Mon Sep 17 00:00:00 2001 From: tylo Date: Mon, 31 Aug 2020 17:18:40 +0200 Subject: Updated clist iterators. --- examples/list.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/list.c b/examples/list.c index c9ec4a16..0da52c9b 100644 --- a/examples/list.c +++ b/examples/list.c @@ -20,11 +20,19 @@ int main() { k = 0; c_foreach (i, clist_fx, list) if (++k <= 10) printf("%8d: %10f\n", k, i.item->value); else break; + puts(""); clist_fx_clear(&list); - c_push(&list, clist_fx, c_items(10, 20, 30, 40, 50)); - c_foreach (i, clist_fx, list) printf("%.1f ", i.item->value); + c_push(&list, clist_fx, c_items(10, 20, 30, 40, 30, 50)); + c_foreach (i, clist_fx, list) printf(" %g", i.item->value); + puts(""); + + int removed = clist_fx_remove(&list, 30); + clist_fx_insert_after(&list, clist_fx_last(&list), 1000); + //clist_fx_insert_after(&list, clist_fx_before_begin(&list), 5); + clist_fx_push_front(&list, 5); + c_foreach (i, clist_fx, list) + printf(" %g", i.item->value); puts(""); - clist_fx_destroy(&list); } \ No newline at end of file -- cgit v1.2.3