Array.this

Initializes this array from another one.

If init is passed by value, it won't be copied, but moved. If the allocator of ($D_PARAM init) matches allocator, $(D_KEYWORD this) will just take the ownership over init's storage, otherwise, the storage will be allocated with allocator and all elements will be moved; init will be destroyed at the end.

If init is passed by reference, it will be copied.

Parameters

R

Source array type.

init R

Source array.

allocator Allocator

Allocator.

Examples

auto v1 = Array!int([1, 2, 3]);
auto v2 = Array!int(v1);
assert(v1 == v2);

auto v3 = Array!int(Array!int([1, 2, 3]));
assert(v1 == v3);
assert(v3.length == 3);
assert(v3.capacity == 3);

Meta