1bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//===----------------------------------------------------------------------===//
2bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
3f5256e16dfc425c1d466f6308d4026d529ce9e0bHoward Hinnant//                     The LLVM Compiler Infrastructure
4bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
5b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// This file is dual licensed under the MIT and the University of Illinois Open
6b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// Source Licenses. See LICENSE.TXT for details.
7bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
8bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//===----------------------------------------------------------------------===//
9bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
10bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// <algorithm>
11bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
12eb564e76cc3904d811c981a50ecce0659f444cc9Howard Hinnant// template<InputIterator Iter1, InputIterator Iter2>
13eb564e76cc3904d811c981a50ecce0659f444cc9Howard Hinnant//   requires HasEqualTo<Iter1::value_type, Iter2::value_type>
14bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//   pair<Iter1, Iter2>
15bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//   mismatch(Iter1 first1, Iter1 last1, Iter2 first2);
16bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
17bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include <algorithm>
18bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include <cassert>
19bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
2083e2c4d877fe2d7793868b1c6a5d9525a7c4d431Marshall Clow#include "test_iterators.h"
21bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
22b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow#if _LIBCPP_STD_VER > 11
23b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow#define HAS_FOUR_ITERATOR_VERSION
24b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow#endif
25b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow
26bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantint main()
27bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant{
28bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
29bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    const unsigned sa = sizeof(ia)/sizeof(ia[0]);
30bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    int ib[] = {0, 1, 2, 3, 0, 1, 2, 3};
31bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(std::mismatch(input_iterator<const int*>(ia),
32bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                         input_iterator<const int*>(ia + sa),
33bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                         input_iterator<const int*>(ib)) ==
34bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                         (std::pair<input_iterator<const int*>,
35bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                                    input_iterator<const int*> >(
36bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                            input_iterator<const int*>(ia+3),
37bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                            input_iterator<const int*>(ib+3))));
38b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow
39b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow#ifdef HAS_FOUR_ITERATOR_VERSION
40b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow    assert(std::mismatch(input_iterator<const int*>(ia),
41b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                         input_iterator<const int*>(ia + sa),
42b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                         input_iterator<const int*>(ib),
43b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                         input_iterator<const int*>(ib + sa)) ==
44b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                         (std::pair<input_iterator<const int*>,
45b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                                    input_iterator<const int*> >(
46b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                            input_iterator<const int*>(ia+3),
47b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                            input_iterator<const int*>(ib+3))));
48b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow
49b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow    assert(std::mismatch(input_iterator<const int*>(ia),
50b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                         input_iterator<const int*>(ia + sa),
51b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                         input_iterator<const int*>(ib),
52b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                         input_iterator<const int*>(ib + 2)) ==
53b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                         (std::pair<input_iterator<const int*>,
54b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                                    input_iterator<const int*> >(
55b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                            input_iterator<const int*>(ia+2),
56b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow                            input_iterator<const int*>(ib+2))));
57b30abdd07a6c6374f4716b7e3a2e343f5db77961Marshall Clow#endif
58bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant}
59