diff --git a/lib/std/array_hash_map.zig b/lib/std/array_hash_map.zig index 02ae8895aa5dfe215176b97c728b7c2e5a1f1ba6..e1007ff27e5e6cd080bf8445dbe2f8b5594aaa2d 100644 --- a/lib/std/array_hash_map.zig +++ b/lib/std/array_hash_map.zig @@ -460,10 +460,19 @@ pub fn ArrayHashMapWithAllocator( /// Sorts the entries and then rebuilds the index. /// `sort_ctx` must have this method: /// `fn lessThan(ctx: @TypeOf(ctx), a_index: usize, b_index: usize) bool` + /// Uses a stable sorting algorithm. pub fn sort(self: *Self, sort_ctx: anytype) void { return self.unmanaged.sortContext(sort_ctx, self.ctx); } + /// Sorts the entries and then rebuilds the index. + /// `sort_ctx` must have this method: + /// `fn lessThan(ctx: @TypeOf(ctx), a_index: usize, b_index: usize) bool` + /// Uses an unstable sorting algorithm. + pub fn sortUnstable(self: *Self, sort_ctx: anytype) void { + return self.unmanaged.sortUnstableContext(sort_ctx, self.ctx); + } + /// Shrinks the underlying `Entry` array to `new_len` elements and /// discards any associated index entries. Keeps capacity the same. ///