diff options
| author | Tyge Løvset <[email protected]> | 2023-02-08 16:16:49 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-02-08 17:18:24 +0100 |
| commit | c4441f5fc665194fbd7a894a67a64a08c3beac42 (patch) | |
| tree | 82f231b6e8fcb75625166f98aa785baaa265a3d6 /misc/examples/csset_erase.c | |
| parent | 673dd5319a488d4b702b94dd9aeda4e497ae4fbc (diff) | |
| download | STC-modified-c4441f5fc665194fbd7a894a67a64a08c3beac42.tar.gz STC-modified-c4441f5fc665194fbd7a894a67a64a08c3beac42.zip | |
Changed to use lowercase flow-control macros in examples (uppercase will still be supported). Improved many examples to use c_make() to init containers.
Diffstat (limited to 'misc/examples/csset_erase.c')
| -rw-r--r-- | misc/examples/csset_erase.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/misc/examples/csset_erase.c b/misc/examples/csset_erase.c index c281c626..e8f2fec5 100644 --- a/misc/examples/csset_erase.c +++ b/misc/examples/csset_erase.c @@ -5,12 +5,11 @@ int main() { - c_AUTO (csset_int, set) + c_auto (csset_int, set) { - c_FORLIST (i, int, {30, 20, 80, 40, 60, 90, 10, 70, 50}) - csset_int_insert(&set, *i.ref); + set = c_make(csset_int, {30, 20, 80, 40, 60, 90, 10, 70, 50}); - c_FOREACH (k, csset_int, set) + c_foreach (k, csset_int, set) printf(" %d", *k.ref); puts(""); @@ -19,7 +18,7 @@ int main() printf("Show values >= %d:\n", val); it = csset_int_lower_bound(&set, val); - c_FOREACH (k, csset_int, it, csset_int_end(&set)) + c_foreach (k, csset_int, it, csset_int_end(&set)) printf(" %d", *k.ref); puts(""); @@ -27,7 +26,7 @@ int main() while (it.ref != csset_int_end(&set).ref) it = csset_int_erase_at(&set, it); - c_FOREACH (k, csset_int, set) + c_foreach (k, csset_int, set) printf(" %d", *k.ref); puts(""); @@ -36,7 +35,7 @@ int main() it = csset_int_lower_bound(&set, val); csset_int_erase_range(&set, csset_int_begin(&set), it); - c_FOREACH (k, csset_int, set) + c_foreach (k, csset_int, set) printf(" %d", *k.ref); puts(""); } |
