diff options
| author | Tyge Løvset <[email protected]> | 2022-08-05 09:20:47 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-08-05 09:20:47 +0200 |
| commit | 94f94957919292b572ea74a30dab5305eaf64808 (patch) | |
| tree | 6026ca73187454f374dd348ab59502025bf013d6 /docs/cpque_api.md | |
| parent | f738106b75d9c4d7998294ffac9ee43f04e18667 (diff) | |
| download | STC-modified-94f94957919292b572ea74a30dab5305eaf64808.tar.gz STC-modified-94f94957919292b572ea74a30dab5305eaf64808.zip | |
Reduce usage of c_apply() macro.
Diffstat (limited to 'docs/cpque_api.md')
| -rw-r--r-- | docs/cpque_api.md | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/docs/cpque_api.md b/docs/cpque_api.md index 12f5c3bc..8b990be8 100644 --- a/docs/cpque_api.md +++ b/docs/cpque_api.md @@ -75,10 +75,14 @@ int main() // Declare heap, with defered drop() c_auto (cpque_i, heap) { - // Push ten million random numbers to priority queue, plus some negative ones. + // Push ten million random numbers to priority queue. c_forrange (N) cpque_i_push(&heap, stc64_uniform(&rng, &dist)); - c_apply(v, cpque_i_push(&heap, *v), int, {-231, -32, -873, -4, -343}); + + // Add some negative ones. + int nums[] = {-231, -32, -873, -4, -343}; + c_forrange (i, c_arraylen(nums)) + cpque_i_push(&heap, nums[i]); // Extract and display the fifty smallest. c_forrange (50) { |
