-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Description
Considering that:
Lines 378 to 388 in ee4df4a
| /// Reduce length to `new_len`. | |
| /// Invalidates element pointers for the elements `items[new_len..]`. | |
| /// Asserts that the new length is less than or equal to the previous length. | |
| pub fn shrinkRetainingCapacity(self: *Self, new_len: usize) void { | |
| assert(new_len <= self.items.len); | |
| self.items.len = new_len; | |
| } | |
| /// Invalidates all element pointers. | |
| pub fn clearRetainingCapacity(self: *Self) void { | |
| self.items.len = 0; |
Both Invalidate pointers to elements, shouldn't we also set all the elements to undefined for better runtime safety?
Let me know, if so i will send a PR for this.
rohlem and IOKG04
Metadata
Metadata
Assignees
Labels
No labels