View source code
Display the source code in std/array.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Function std.array.insertInPlace
Inserts stuff
(which must be an input range or any number of
implicitly convertible items) in array
at position pos
.
void insertInPlace(T, U...)
(
ref T[] array,
size_t pos,
U stuff
)
if (!isSomeString!(T[]) && allSatisfy!(isInputRangeOrConvertible!T, U) && (U .length > 0));
void insertInPlace(T, U...)
(
ref T[] array,
size_t pos,
U stuff
)
if (isSomeString!(T[]) && allSatisfy!(isCharOrStringOrDcharRange, U));
Parameters
Name | Description |
---|---|
array | The array that stuff will be inserted into. |
pos | The position in array to insert the stuff . |
stuff | An input range,
or any number of implicitly convertible items to insert into array . |
Example
int[] a = [ 1, 2, 3, 4 ];
a .insertInPlace(2, [ 1, 2 ]);
writeln(a); // [1, 2, 1, 2, 3, 4]
a .insertInPlace(3, 10u, 11);
writeln(a); // [1, 2, 1, 10, 11, 2, 3, 4]
Authors
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.