aboutsummaryrefslogtreecommitdiff
path: root/lib/std/priority_queue.zig
AgeCommit message (Collapse)Author
2022-07-22PriorityQueue: use compareFn in update()VÖRÖSKŐI András
update() calls mem.indexOfScalar() which uses `==` for comparing items, which fails when the operator is not supported. As PirorityQueue needs a comparing function anyway we can use `.eq` results to identify matching objects. closes #9918
2022-06-28Revert "AstGen: preserve inferred ptr result loc for breaks"Andrew Kelley
This reverts commit 8bf3e1f8d0902abd4133e2729b3625c25011c3ff, which introduced miscompilations for peer expressions any time they needed coercions to runtime types. I opened #11957 as a proposal to accomplish the goal of the reverted commit. Closes #11898
2022-06-12std: disable failing tests, add zig2 build test-std to CIVeikka Tuominen
2022-06-07std: adjust for stage2 semanticsVeikka Tuominen
2022-05-26std.PriorityQueue: fix missing siftUp in removejoachimschmidt557
When the replacement node is smaller than its parent, we need to sift up instead of sifting down.
2022-04-14Fix bug in PriorityQueue::removeIndex()Eric Shrewsberry
Fix to call siftDown on the removed index instead of always on index 0. Updated test to a test that fails before and passes now. PriorityDequeue does not have this issue.
2021-12-15std.priority_queue: allow comparator to take a context parameterArnavion
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-11-30std lib API deprecations for the upcoming 0.9.0 releaseAndrew Kelley
See #3811
2021-10-17Move `compareFn` from init to type constructor in `PriorityQueue` and ↵Max Hollmann
`PriorityDequeue`. This change significantly improves performance for simple compare functions and modifies the API to be more consistent with e.g. `HashMap`.
2021-09-19std.PriorityQueue: ensureUnusedCapacity and ensureTotalCapacityRyan Liptak
Same as c8ae581fef6506a8234cdba1355ba7f0f449031a, but for PriorityQueue.
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-06-21fix code broken from previous commitJacob G-W
2021-05-12fix shrinkAndFree and remove shrinkRetainingCapacity in PriorityQueue and ↵Matthew Borkowski
PriorityDequeue
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-04-02Merge pull request #7792 from zanderxyz/zanderxyz/priority-dequeueAndrew Kelley
std: Add Priority Dequeue
2021-02-27HashMap.put returns !void, not a !booldaurnimator
2021-01-18Change `compareFn` to `fn (a: T, b: T) std.math.Order`Zander Khan
2021-01-17Remove `resize`. Adding uninitialized memory at the end of the `items` would ↵Zander Khan
break the heap property.
2021-01-17Replace `shrink` with `shrinkAndFree` and `shrinkRetainingCapacity`Zander Khan
2021-01-16Fix slice length when updatingZander Khan
2021-01-16Fix update might change an element no longer in the queueZander Khan
2021-01-16Fix edge cases in fromOwnedSliceZander Khan
2021-01-16Add missing importZander Khan
2020-12-31Year++Frank Denis
2020-12-09small fixes and zig fmtVexu
2020-09-22removing redundant assertBhargav Srinivasan
2020-09-22return not found error correctlyBhargav Srinivasan
2020-09-22replace linearSearch with mem.indexOfScalar, return not found error, factor ↵Bhargav Srinivasan
out siftUp from addUnchecked, use compareFn to decide siftUp/siftDown
2020-09-22implemented efficient heapreplaceBhargav Srinivasan
2020-09-22items are not sorted, using linear searchBhargav Srinivasan
2020-09-22sorry, local compiler using different version of zigBhargav Srinivasan
2020-09-22using binary search function from std.sortBhargav Srinivasan
2020-09-21adding a function to update the priority of an elementBhargav Srinivasan
2020-09-10Fix issue #6303: iterating empty PriorityQueue crashesLiterally Void
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-07-04std.mem.dupe is deprecated, move all references in stdjoachimschmidt557
Replaced all occurences of std.mem.dupe in stdlib with Allocator.dupe/std.mem.dupeZ -> Allocator.dupeZ
2020-05-13Make PriorityQueue.Iterator publicVexu
The `iterator` function was already public but these seem to have been forgotten.
2020-01-29Promoted "leak_count_allocator" to the main testing.allocatorBenjamin Feng
2020-01-29Create leak_count_allocatorBenjamin Feng
2020-01-29Move debug.global_allocator to testing.allocatorBenjamin Feng
2020-01-08Add removeIndex function to PriorityQueue (#4070)Nathan Michaels
It's awkward to use, but lets me cancel events in an event queue. Co-authored-by: Dmitry Atamanov <data-man@users.noreply.github.com>
2019-12-08std.fmt.format: tuple parameter instead of var argsAndrew Kelley
2019-11-27remove type coercion from array values to referencesAndrew Kelley
* Implements #3768. This is a sweeping breaking change that requires many (trivial) edits to Zig source code. Array values no longer coerced to slices; however one may use `&` to obtain a reference to an array value, which may then be coerced to a slice. * Adds `IrInstruction::dump`, for debugging purposes. It's useful to call to inspect the instruction when debugging Zig IR. * Fixes bugs with result location semantics. See the new behavior test cases, and compile error test cases. * Fixes bugs with `@typeInfo` not properly resolving const values. * Behavior tests are passing but std lib tests are not yet. There is more work to do before merging this branch.
2019-11-08update the codebase to use `@as`Andrew Kelley
2019-10-30Document PriorityQueue.Nathan Michaels
2019-09-25mv std/ lib/Andrew Kelley
that's all this commit does. further commits will fix cli flags and such. see #2221