append

Append arguments args to data.

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

Examples

int[] data;
import std.range: only, iota;

data.append(-1, 0, only(1, 2, 3), iota(4, 9));
assert(data == [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8]);

data.append(9, 10);
assert(data == [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);

data.append([11, 12], [13, 14]);
assert(data == [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);

// int[3] d;
// data.append(d, d);

static assert(!__traits(compiles, { data.append(); }));

See Also

Meta