On Friday, 19 December 2025 at 12:21:16 UTC, Brother Bill wrote:
I notice that std.algorithm and std.algorithm.mutate return a new dynamic array. Are there any libraries out there that do modifications in place?

For example, for dynamic array items

```
int[] items = [ 10, 20, 30, 40 ];

// Library call to do in place mutations of items dynamic array, without any new allocations
items.remove(1);

assert(items == [10, 30, 40];
assert(items.length == 3);
```

It does modify elements in-place, it doesn't modify `items.length`. Do `items = items.remove(1);`.

Note that remove does not change the length of the original range directly; instead, it returns the shortened range. If its return value is not assigned to the original range, the original range will retain its original length, though its contents will have changed

https://dlang.org/phobos/std_algorithm_mutation.html#remove

Reply via email to