C++ Algorithm Functions mismatch()
C++ Algorithm mismatch() function compares both the containers to spot for any mismatch of values. The function returns the first element of both the containers that does not match.
first1: It is an input iterator to the first element of the [first1, last1).
last1: It is an input iterator to the last element of the [first1, last1).
first2: It is an input iterator to the first element of the [first2, last2).
pred: It is a binary function that accepts two elements as arguments and performs the task designed by the function.
If the function finds a pair of elements that does not match then it returns the first pair of such element, one from each container.
In case none of the elements from the containers match the the function returns the pair(first1, first2)
If the entire element in the pair matches then the function returns a pair of last1 and the element with same respective position to last1 in the second container.
Out of the given elements the first mismatching pair is: 30 and 80 The next pair of mismatching elements are: 40 and 320
From the first container the element that does not match is: 23 From the second container the element that does not match container is: 1 From firt container return value is:12 From second container return value is: 1
The function has linear complexity from the first1 element to the last1 element.
Objects in both ranges are accessed.
The function throws an exception if any of the argument throws one.