www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Resizable Arrays?

reply bearophile <bearophileHUGS lycos.com> writes:
Jason House>By dynamic, do you mean no length as part of the type or resizable
in place? Array resizing can lead to hidden allocations,<

Thy aren't hidden: when you grow a dynamic array you know an allocation
generally takes place. If you don't want reallocations, then never grow or join
them, and the reallocations will not happen. There's nothing hidden.

Bye,
bearophile
Feb 28 2009
parent Lutger <lutger.blijdestijn gmail.com> writes:
bearophile wrote:

 Jason House>By dynamic, do you mean no length as part of the type or 

 
 Thy aren't hidden: when you grow a dynamic array you know an allocation 

join them, and the reallocations will not happen. There's nothing hidden.
 
 Bye,
 bearophile

I agree, it's something that I think is quickly understood by newcomers to the language. It's the same problem as string concatenation in C# and Java, where the common idiom is to use StringBuilder. I have seen such builders floating around in the ng, but is it phobos or tango already?
Mar 01 2009