std.container update

bearophile bearophileHUGS at lycos.com
Fri May 28 05:10:40 PDT 2010


Jonathan M Davis:

> The biggest difference is that a vector has capacity separate from its 
> size/length. You can efficiency insert elements at the end with a vector - 
> amortized constant time usually - but you can't do that with a built-in 
> array because it would have to reallocate every time. D's arrays are 
> fantastic, but they're still not quite good enough to outright replace a 
> vector type.

I can think about the opposite too: to remove the built-in dynamic arrays and replace them as it's being done with associative arrays, keeping only the syntax sugar and mapping them to the Array/Vector. Is this a bad idea? (this is only about dynamic arrays, at the moment built-in fixed-sized arrays have to be kept).

Bye,
bearophile


More information about the Digitalmars-d mailing list