diff options
| author | Tyge Løvset <[email protected]> | 2023-03-26 00:27:45 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-03-26 00:27:45 +0100 |
| commit | eb85069b669e754836b9d4587ba03d3af1a5e975 (patch) | |
| tree | 45c9a0d3fe40c59a8b33ae8ecd2e7aa78bef6240 /misc/examples/functor.c | |
| parent | e8be14dfc894eeac859f0287d4d5b4f4745c0585 (diff) | |
| download | STC-modified-eb85069b669e754836b9d4587ba03d3af1a5e975.tar.gz STC-modified-eb85069b669e754836b9d4587ba03d3af1a5e975.zip | |
development branch for 4.2
Removed uses of c_auto and c_with in documentation examples and code examples. Still using c_defer a few places.
Renamed c11/fmt.h to c11/print.h.
Some additions in ccommon.h, e.g. c_const_cast(T, x).
Improved docs.
Diffstat (limited to 'misc/examples/functor.c')
| -rw-r--r-- | misc/examples/functor.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/misc/examples/functor.c b/misc/examples/functor.c index 6d42c4f8..8952c710 100644 --- a/misc/examples/functor.c +++ b/misc/examples/functor.c @@ -51,18 +51,17 @@ int main() IPQueue q1 = {ipque_init(), int_less}; // Max priority queue IPQueue minq1 = {ipque_init(), int_greater}; // Min priority queue IPQueue q5 = {ipque_init(), int_lambda}; // Using lambda to compare elements. - c_defer (ipque_drop(&q1.Q), ipque_drop(&minq1.Q), ipque_drop(&q5.Q)) - { - c_forrange (i, n) - ipque_push(&q1.Q, data[i]); - print_queue("q1", q1); + c_forrange (i, n) + ipque_push(&q1.Q, data[i]); + print_queue("q1", q1); - c_forrange (i, n) - ipque_push(&minq1.Q, data[i]); - print_queue("minq1", minq1); + c_forrange (i, n) + ipque_push(&minq1.Q, data[i]); + print_queue("minq1", minq1); - c_forrange (i, n) - ipque_push(&q5.Q, data[i]); - print_queue("q5", q5); - } + c_forrange (i, n) + ipque_push(&q5.Q, data[i]); + print_queue("q5", q5); + + c_drop(ipque, &q1.Q, &minq1.Q, &q5.Q); } |
