View source code
Display the source code in std/algorithm/comparison.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.algorithm.comparison.mismatch
Sequentially compares elements in
and r1
in lockstep, and
stops at the first r2
mismatch
(according to pred
, by default
equality). Returns a tuple with the reduced ranges that start with the
two mismatched values. Performs Ο(
)
evaluations of min
(r1.length, r2.length)pred
.
Prototype
Tuple!(Range1,Range2) mismatch(alias pred, Range1, Range2)( Range1 r1, Range2 r2 ) if (isInputRange!Range1 && isInputRange!Range2);
See Also
Example
int[] x = [ 1, 5, 2, 7, 4, 3 ]; double[] y = [ 1.0, 5, 2, 7.3, 4, 8 ]; auto m = mismatch(x, y); assert(m[0] == x[3 .. $]); assert(m[1] == y[3 .. $]);