more sorting...
This commit is contained in:
parent
bdb4b0537d
commit
ac17a79631
@ -49,7 +49,7 @@ pub fn ReverseSliceIterator(comptime T: type) type {
|
||||
}
|
||||
|
||||
/// sorts items using lessThan and keeps sub_items with the same sort
|
||||
pub fn sortSub(comptime T1: type, comptime T2: type, items: []T1, sub_items: []T2, lessThan: fn (void, lhs: T1, rhs: T1) bool) void {
|
||||
pub fn sortSub(comptime T1: type, comptime T2: type, items: []T1, sub_items: []T2, comptime lessThan: fn (void, lhs: T1, rhs: T1) bool) void {
|
||||
var i: usize = 1;
|
||||
while (i < items.len) : (i += 1) {
|
||||
const x = items[i];
|
||||
|
@ -134,7 +134,13 @@ pub fn MultiView(comptime n_includes: usize, comptime n_excludes: usize) type {
|
||||
sub_items[i] = store.len();
|
||||
}
|
||||
|
||||
utils.sortSub(usize, u32, sub_items[0..], self.type_ids[0..], std.sort.asc(usize));
|
||||
const asc_usize = struct {
|
||||
fn sort(ctx: void, a: usize, b: usize) bool {
|
||||
return a < b;
|
||||
}
|
||||
};
|
||||
|
||||
utils.sortSub(usize, u32, sub_items[0..], self.type_ids[0..], asc_usize.sort);
|
||||
}
|
||||
|
||||
pub fn iterator(self: *Self) Iterator {
|
||||
|
Loading…
x
Reference in New Issue
Block a user