mirror of
https://codeberg.org/kaasboteram/zig-iterating.git
synced 2025-12-15 09:43:14 +01:00
Add size hint for Range
This commit is contained in:
parent
8df72a0c79
commit
9bb6c03127
1 changed files with 4 additions and 0 deletions
|
|
@ -362,6 +362,10 @@ pub fn Range(comptime T: type, end_type: RangeEndType) type {
|
||||||
defer self.current += 1;
|
defer self.current += 1;
|
||||||
return self.current;
|
return self.current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn sizeHint(self: *const Self) usize {
|
||||||
|
return self.end - self.current + @intFromBool(end_type == .inclusive);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue