SList.remove

Remove the element at the given idx from the list. If there are no more references to the given element, then it will be destroyed.

struct SList(T)
void
remove
(
size_t idx = 0
)

Parameters

idx size_t

a positive integer

Examples

import std.algorithm.comparison : equal;

auto sl = SList!int(1, 2, 3);
auto sl2 = sl;
auto pos = 1;

assert(equal(sl, [1, 2, 3]));
sl.remove(pos);
assert(equal(sl, [1, 3]));
assert(equal(sl2, [1, 3]));

Meta