SList.save

Perform a shallow copy of the list.

struct SList(T)
ref
Qualified
save
(
this Qualified
)
()

Return Value

Type: Qualified

a new reference to the current list.

Complexity: O(1).

Examples

auto a = [1, 2, 3];
auto sl = SList!int(a);
size_t i = 0;

auto tmp = sl.save;
while (!tmp.empty)
{
    assert(tmp.front == a[i++]);
    tmp.popFront;
}
assert(tmp.empty);
assert(!sl.empty);

Meta