mismatch

Sequentially compares elements in rs in lockstep, and stops at the first mismatch (according to pred, by default equality). Returns a tuple with the reduced ranges that start with the two mismatched values. Performs O(min(r[0].length, r[1].length, ...)) evaluations of pred.

Tuple!(Ranges)
mismatch
(
alias pred =
(
a
,
b
)
=> a == b
Ranges...
)
(
Ranges rs
)
if (
rs.length >= 2 &&
)

Examples

int[6] x = [ 1,   5, 2, 7,   4, 3 ];
double[6] y = [ 1.0, 5, 2, 7.3, 4, 8 ];
auto m = mismatch(x[], y[]);
assert(m[0] == x[3 .. $]);
assert(m[1] == y[3 .. $]);

auto m2 = mismatch(x[], y[], x[], y[]);
assert(m2[0] == x[3 .. $]);
assert(m2[1] == y[3 .. $]);
assert(m2[2] == x[3 .. $]);
assert(m2[3] == y[3 .. $]);

Meta