Function save

Returns a copy of the slice array.

inout(T)[] save(T) (
  scope return inout(T)[] array
) @property;

save doesn't copy the array itself, but only the data pointer and the length.

Parameters

NameDescription
T Element type of array.
array Built-in array.

Returns

A copy of the slice array.

Example

ubyte[8] array;
auto slice = array.save;

assert(slice.length == array.length);
slice.popFront();
assert(slice.length < array.length);