Function equal
Compares element-wise two ranges for equality.
bool equal(alias pred, R1, R2)
(
R1 r1,
R2 r2
)
if (allSatisfy!(isInputRange, R1, R2) && is(typeof(pred(r1 .front, r2 .front)) == bool));
If the ranges have different lengths, they aren't equal.
Parameters
Name | Description |
---|---|
pred | Predicate used to compare individual element pairs. |
R1 | First range type. |
R2 | Second range type. |
r1 | First range. |
r2 | Second range. |
Returns
true if both ranges are equal, false otherwise.
Example
int[2] range1 = [1, 2];
assert(equal(range1[], range1[]));
int[3] range2 = [1, 2, 3];
assert(!equal(range1[], range2[]));