SList.opBinary

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

struct SList(T)
ref
opBinary
(
string op
U
)
(
auto ref U rhs
)
if (
op == "~" &&
(
is(U == 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 singly linked list

Return Value

Type: auto ref

the newly created list

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

Examples

import std.algorithm.comparison : equal;

auto sl = SList!int(1);
auto sl2 = sl ~ 2;

assert(equal(sl2, [1, 2]));
sl.front = 0;
assert(equal(sl2, [1, 2]));

Meta