Array.opAssign - multiple declarations

Function Array.opAssign

Assigns another array.

ref typeof(this) opAssign(R) (
  ref R that
)
if (is(Unqual!R == Array));

ref typeof(this) opAssign(R) (
  R that
)
if (is(R == Array));

If that is passed by value, it won't be copied, but moved. This array will take the ownership over that's storage and the allocator.

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

Parameters

NameDescription
R Content type.
that The value should be assigned.

Returns

this.

Function Array.opAssign

Assigns a range to the array.

ref typeof(this) opAssign(R) (
  scope R that
)
if (!isInfinite!R && isInputRange!R && isImplicitlyConvertible!(ElementType!R, T));

Parameters

NameDescription
R Content type.
that The value should be assigned.

Returns

this.

Example

auto v1 = const Array!int([5, 15, 8]);
Array!int v2;
v2 = v1;
assert(v1 == v2);

Function Array.opAssign

Assigns a static array.

ref typeof(this) opAssign(size_t R) (
  T[R] that
);

Parameters

NameDescription
R Static array size.
that Values to initialize the array with.

Returns

this.

Example

auto v1 = Array!int([5, 15, 8]);
Array!int v2;

v2 = [5, 15, 8];
assert(v1 == v2);