SList.dup

Perform a copy of the list. This will create a new list that will copy the elements of the current list. This will NOT call dup on the elements of the list, regardless if T defines it or not.

struct SList(T)
dup
(
this Q
)
()

Return Value

Type: SList!T

a new list.

Complexity: O(n).

Examples

import std.algorithm.comparison : equal;

auto stuff = [1, 2, 3];
auto sl = immutable SList!int(stuff);
auto slDup = sl.dup;
assert(equal(slDup, stuff));
slDup.front = 0;
assert(slDup.front == 0);
assert(sl.front == 1);

Meta