SList.opOpAssign

Append the elements of rhs at the end of the list.

If no allocator was provided when the list was created, the GCAllocator.std.experimental.allocator. will be used.

struct SList(T)
ref
opOpAssign
(
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

a reference to this list

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

Examples

import std.algorithm.comparison : equal;

auto s = SList!int(4, 5);
SList!int sl;
assert(sl.empty);

sl ~= 1;
sl ~= [2, 3];
assert(equal(sl, [1, 2, 3]));

// append an input range
sl ~= s;
assert(equal(sl, [1, 2, 3, 4, 5]));
s.front = 0;
assert(equal(sl, [1, 2, 3, 4, 5]));

Meta