Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | 5b08a8a | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <algorithm> |
| 11 | |
Howard Hinnant | 664ae81 | 2010-08-22 00:08:10 +0000 | [diff] [blame^] | 12 | // template<InputIterator Iter1, InputIterator Iter2> |
| 13 | // requires HasEqualTo<Iter1::value_type, Iter2::value_type> |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 14 | // pair<Iter1, Iter2> |
| 15 | // mismatch(Iter1 first1, Iter1 last1, Iter2 first2); |
| 16 | |
| 17 | #include <algorithm> |
| 18 | #include <cassert> |
| 19 | |
| 20 | #include "../../iterators.h" |
| 21 | |
| 22 | int main() |
| 23 | { |
| 24 | int ia[] = {0, 1, 2, 2, 0, 1, 2, 3}; |
| 25 | const unsigned sa = sizeof(ia)/sizeof(ia[0]); |
| 26 | int ib[] = {0, 1, 2, 3, 0, 1, 2, 3}; |
| 27 | assert(std::mismatch(input_iterator<const int*>(ia), |
| 28 | input_iterator<const int*>(ia + sa), |
| 29 | input_iterator<const int*>(ib)) == |
| 30 | (std::pair<input_iterator<const int*>, |
| 31 | input_iterator<const int*> >( |
| 32 | input_iterator<const int*>(ia+3), |
| 33 | input_iterator<const int*>(ib+3)))); |
| 34 | } |