//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // template Pred> // requires CopyConstructible // Iter1 // find_first_of(Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, Pred pred); #include #include #include #include "../../../iterators.h" int main() { int ia[] = {0, 1, 2, 3, 0, 1, 2, 3}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[] = {1, 3, 5, 7}; const unsigned sb = sizeof(ib)/sizeof(ib[0]); assert(std::find_first_of(input_iterator(ia), input_iterator(ia + sa), forward_iterator(ib), forward_iterator(ib + sb), std::equal_to()) == input_iterator(ia+1)); int ic[] = {7}; assert(std::find_first_of(input_iterator(ia), input_iterator(ia + sa), forward_iterator(ic), forward_iterator(ic + 1), std::equal_to()) == input_iterator(ia+sa)); assert(std::find_first_of(input_iterator(ia), input_iterator(ia + sa), forward_iterator(ic), forward_iterator(ic), std::equal_to()) == input_iterator(ia+sa)); assert(std::find_first_of(input_iterator(ia), input_iterator(ia), forward_iterator(ic), forward_iterator(ic+1), std::equal_to()) == input_iterator(ia)); }