mismatch

Sequentially compares elements in r1 and r2 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(r1.length, r2.length)) evaluations of pred.

Tuple!(Range1, Range2)
mismatch
(
alias pred = "a == b"
Range1
Range2
)
(
Range1 r1
,
Range2 r2
)
if (
isInputRange!(Range1) &&
isInputRange!(Range2)
)

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 .. $]);

Meta

Suggestion Box / Bug Report