Mixing std.container.array and Appender
IchorDev
zxinsworld at gmail.com
Sat Feb 7 04:31:33 UTC 2026
On Wednesday, 4 February 2026 at 08:45:06 UTC, axricard wrote:
> Hello, is there some structure in standard library that acts
> like Appender but works also on std.container.array Arrays ?
> I'd like to have the capacity of Arrays doubling every time new
> memory is allocated.
> Appender requires the input to be a dynamic array, which is not
> the case for std.container.array Arrays.
`Appender` only exists so that you can continually append to a
dynamic array without the GC having to look up its `capacity` for
every append. `Array` already keeps track of its own
[`capacity`](https://dlang.org/phobos/std_container_array.html#.Array.capacity), so you don't need to use an `Appender` on it, just use `Array` on its own.
More information about the Digitalmars-d-learn
mailing list