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, ForwardIterator Iter2>
13 // requires HasEqualTo<Iter1::value_type, Iter2::value_type>
14 // Iter1
15 // find_first_of(Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2);
16
17 #include <algorithm>
18 #include <cassert>
19
20 #include "test_iterators.h"
21
main()22 int main()
23 {
24 int ia[] = {0, 1, 2, 3, 0, 1, 2, 3};
25 const unsigned sa = sizeof(ia)/sizeof(ia[0]);
26 int ib[] = {1, 3, 5, 7};
27 const unsigned sb = sizeof(ib)/sizeof(ib[0]);
28 assert(std::find_first_of(input_iterator<const int*>(ia),
29 input_iterator<const int*>(ia + sa),
30 forward_iterator<const int*>(ib),
31 forward_iterator<const int*>(ib + sb)) ==
32 input_iterator<const int*>(ia+1));
33 int ic[] = {7};
34 assert(std::find_first_of(input_iterator<const int*>(ia),
35 input_iterator<const int*>(ia + sa),
36 forward_iterator<const int*>(ic),
37 forward_iterator<const int*>(ic + 1)) ==
38 input_iterator<const int*>(ia+sa));
39 assert(std::find_first_of(input_iterator<const int*>(ia),
40 input_iterator<const int*>(ia + sa),
41 forward_iterator<const int*>(ic),
42 forward_iterator<const int*>(ic)) ==
43 input_iterator<const int*>(ia+sa));
44 assert(std::find_first_of(input_iterator<const int*>(ia),
45 input_iterator<const int*>(ia),
46 forward_iterator<const int*>(ic),
47 forward_iterator<const int*>(ic+1)) ==
48 input_iterator<const int*>(ia));
49 }
50