-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Description
Summary
As for siftUp and siftDown they should be handled by the user too. The solution is to make them public.
In cache-like systems where an item has been taken you need to do a siftUp to update the priority. Flexibility and control over it is important.
It is also needed in the function addSiftUp that it replaces add. This is because there are some contexts where add should not do a siftUp.
It is not a proposal: the std.PriorityQueue function is just that. And having these limits is an implementation error.
💡 Proposed Solution
pub fn add(self: *Self, elem: T) !void
pub fn addSiftUp(self: *Self, elem: T) !void
pub fn siftUp(self: *Self, index: usize) void
pub fn siftDown(self: *Self, index: usize) voidMetadata
Metadata
Assignees
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.