std.BoundedArray: add clear()

This commit is contained in:
mlugg
2024-08-17 11:40:25 +01:00
committed by Jacob Young
parent 9c3324173d
commit 7f2466e65f
2 changed files with 6 additions and 1 deletions

View File

@@ -72,6 +72,11 @@ pub fn BoundedArrayAligned(
self.len = @intCast(len);
}
/// Remove all elements from the slice.
pub fn clear(self: *Self) void {
self.len = 0;
}
/// Copy the content of an existing slice.
pub fn fromSlice(m: []const T) error{Overflow}!Self {
var list = try init(m.len);