Array.opEquals - multiple declarations

Function Array.opEquals

Comparison for equality.

bool opEquals (
  auto ref typeof(this) that
) @trusted;

bool opEquals (
  auto const ref typeof(this) that
) const @trusted;

bool opEquals (
  Array.Range that
);

Parameters

NameDescription
that The array to compare with.

Returns

true if the arrays are equal, false otherwise.

Function Array.opEquals

Comparison for equality.

bool opEquals(R) (
  R that
) const
if (is(R == Range) || is(R == ConstRange));

Parameters

NameDescription
R Right hand side type.
that Right hand side array range.

Returns

true if the array and the range are equal, false otherwise.

Example

Array!int v1, v2;
assert(v1 == v2);

v1.length = 1;
v2.length = 2;
assert(v1 != v2);

v1.length = 2;
v1[0] = v2[0] = 2;
v1[1] = 3;
v2[1] = 4;
assert(v1 != v2);

v2[1] = 3;
assert(v1 == v2);