Array.opBinary

Create a new array that results from the concatenation of this array with rhs.

struct Array(T)
ref
opBinary
(
string op
U
)
(
auto ref U rhs
)
if (
op == "~" &&
(
is(U : const typeof(this)) ||
is(U : T)
||
(
isInputRange!U &&
isImplicitlyConvertible!(ElementType!U, T)
)
)
)

Parameters

rhs U

can be an element that is implicitly convertible to T, an input range of such elements, or another Array

Return Value

Type: auto ref

the newly created array

Complexity: O(n + m), where m is the number of elements in rhs.

Examples

import std.algorithm.comparison : equal;

auto a = Array!int(1);
auto a2 = a ~ 2;

assert(equal(a2, [1, 2]));
a.front = 0;
assert(equal(a2, [1, 2]));

Meta