1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <algorithm> 11 12 // template<InputIterator Iter1, InputIterator Iter2, 13 // Predicate<auto, Iter1::value_type, Iter2::value_type> Pred> 14 // requires CopyConstructible<Pred> 15 // pair<Iter1, Iter2> 16 // mismatch(Iter1 first1, Iter1 last1, Iter2 first2, Pred pred); 17 18 #include <algorithm> 19 #include <functional> 20 #include <cassert> 21 22 #include "test_iterators.h" 23 24 int main() 25 { 26 int ia[] = {0, 1, 2, 2, 0, 1, 2, 3}; 27 const unsigned sa = sizeof(ia)/sizeof(ia[0]); 28 int ib[] = {0, 1, 2, 3, 0, 1, 2, 3}; 29 assert(std::mismatch(input_iterator<const int*>(ia), 30 input_iterator<const int*>(ia + sa), 31 input_iterator<const int*>(ib), 32 std::equal_to<int>()) == 33 (std::pair<input_iterator<const int*>, 34 input_iterator<const int*> >( 35 input_iterator<const int*>(ia+3), 36 input_iterator<const int*>(ib+3)))); 37 assert(std::mismatch(ia, ia + sa, ib, std::equal_to<int>()) == 38 (std::pair<int*,int*>(ia+3,ib+3))); 39 } 40