array idioms

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Feb 25 12:30:00 PST 2011


On 2/25/11, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
>
>> * insert an element in a dyn array
>
> Same as remove. There's no function for doing it at the moment.

std.array.insert:

int[] a = [ 1, 2, 3, 4 ];
a.insert(2, [ 1, 2 ]);
assert(a == [ 1, 2, 1, 2, 3, 4 ]);

afaik insert was missing from the documentation in the last release
(I've reported it), but now it's back in. So maybe that's why nobody
knew about it.


More information about the Digitalmars-d-learn mailing list