dynamic array capacity

spir denis.spir at gmail.com
Wed Dec 29 04:29:29 PST 2010


Hello,

Is there a common idiom to pre-allocate a dynamic array. I mean allocating to avoid numerous re-allocations in loop, not setting length & filling content.
The differences are:
(0) no content --> no init
(1) one can simply append, instead of setting elements at defined indices
(2) one can append sub-sequences
(3) when the initially requested capacity is full, the array automagically resizes as needed (usng D's builtin dynarray realloc scheme).

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d-learn mailing list