Is std.container.array more or less an equivalent of C#'s List<T>?
Steven Schveighoffer
schveiguy at yahoo.com
Mon Dec 4 16:54:25 UTC 2017
On 12/4/17 11:26 AM, A Guy With a Question wrote:
> Reading this, the interface seems very similar, but I'm not sure.
> There's only like a two sentence general description, then it goes on to
> talk about a boolean specialization...
>
> https://dlang.org/phobos/std_container_array.html
>
> I'm looking for something that doesn't have to resize every
> insert/append, but also it's going to be copying the whole array either
> each time.
Appending is amortized (IIRC, it doubles the size when it needs more
space), everything else must copy data. It's an array underneath, but
instead of using the GC, it uses C heap functions.
It isn't really any different than a D builtin array, but has some
better performance characteristics in some cases. It's also not safe to
keep pointers to elements if it reallocs.
-Steve
More information about the Digitalmars-d-learn
mailing list