DList.save

Perform a shallow copy of the list.

struct DList(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 dl = DList!int(a);
size_t i = 0;

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

Meta