Array.save

Perform a shallow copy of the array.

struct Array(T)
ref
save
(
this _
)
()

Return Value

Type: auto ref

a new reference to the current array.

Complexity: O(1).

Examples

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

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

Meta