Thread overview
Is std.container.array more or less an equivalent of C#'s List<T>?
Dec 04, 2017
Basile B.
December 04, 2017
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.
December 04, 2017
On Monday, 4 December 2017 at 16:26:02 UTC, 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.

For clarity (had a typo in the original question). I do not want it copying the entire array every time. I'm looking for something close to C#'s List<T>.
December 04, 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
December 04, 2017
On Monday, 4 December 2017 at 16:26:02 UTC, 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.

std.Array.Appender

or

iz.containers.Array