append

Append arguments $(args) to data.

ref
R
append
(
R
Args...
)
(
ref R data
,
auto ref Args args
)
if (
args.length != 0
)

Examples

1 int[] data;
2 import std.range: only, iota;
3 
4 data.append(-1, 0, only(1, 2, 3), iota(4, 9));
5 assert(data == [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]);
6 
7 data.append(9, 10);
8 assert(data == [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
9 
10 data.append([11, 12], [13, 14]);
11 assert(data == [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
12 
13 // int[3] d;
14 // data.append(d, d);
15 
16 static assert(!__traits(compiles, { data.append(); }));

See Also

Meta