blob: 0ab71de8e10609cd089dadff62a351aa5ebd4704 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
Howard Hinnant412dbeb2010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant3e519522010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10// <algorithm>
11
Howard Hinnant664ae812010-08-22 00:08:10 +000012// template<InputIterator Iter1, InputIterator Iter2>
13// requires HasEqualTo<Iter1::value_type, Iter2::value_type>
Howard Hinnant3e519522010-05-11 19:42:16 +000014// pair<Iter1, Iter2>
15// mismatch(Iter1 first1, Iter1 last1, Iter2 first2);
16
17#include <algorithm>
18#include <cassert>
19
Marshall Clowf8c2b822013-01-04 18:24:04 +000020#include "../../../iterators.h"
Howard Hinnant3e519522010-05-11 19:42:16 +000021
22int 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}