stl:algorithm:mismatch

C++ Reference

mismatch

Syntax:

    #include <algorithm>
    pair <iterator1,iterator2> mismatch( iterator start1, iterator end1, iterator start2 );
    pair <iterator1,iterator2> mismatch( iterator start1, iterator end1, iterator start2, BinPred p );

The mismatch() function compares the elements in the range defined by [start1,end1) to the elements in a range of the same size starting at start2.

The return value of mismatch() is the first location where the two ranges differ.

If the optional binary predicate p is given, then it is used to compare elements from the two ranges.

The mismatch() algorithm runs in linear time.

Related Topics: equal, find, lexicographical_compare, search