|
|
template <class T>
const T* mismatch(
const T* b1, const T* e1,
const T* b2, const T* e2
);
template <class T>
const T* mismatch_r(
int (*rel)(const T*,const T*),
const T* b1, const T* e1,
const T* b2, const T* e2
);
(1) For the plain version, T::operator== defines an equivalence relation on T.
(2) For the relational version, rel defines an equivalence relation on T.
These functions return a pointer to the leftmost element within the first array which is not equal to the corresponding element in the second array. Returns 0 if no mismatch occurs.
template <class T>
const T* mismatch(
const T* b1, const T* e1,
const T* b2, const T* e2
);
Uses T::operator== to define equality.
template <class T>
const T* mismatch_r(
int (*rel)(const T*,const T*),
const T* b1, const T* e1,
const T* b2, const T* e2
);
Uses rel to define equality.
If N and M are the sizes of the arrays, the complexity is O(N+M). At most min(N,M) equality tests are done.
Because a Block (see Block(3C++)) can always be used wherever an array is called for, Array Algorithms can also be used with Blocks. In fact, these two components were actually designed to be used together.