mismatch [C++ Reference]
Keywords: stl,algorithm,mismatch
Date: 2009-10-09T01:00:54-0700

[[mismatch]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## mismatch

Syntax:

        #include <algorithm>
        pair <input_iterator1,input_iterator2> mismatch( input_iterator1 start1, input_iterator1 end1, input_iterator2 start2 );
        pair <input_iterator1,input_iterator2> mismatch( input_iterator1 start1, input_iterator1 end1, input_iterator2 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 either:

- The first location where the two ranges differ.
- If the ranges are equal, `end1` and the corresponding element in second range.

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

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •