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<ForwardIterator Iter> 13 // requires EqualityComparable<Iter::value_type> 14 // Iter 15 // adjacent_find(Iter first, Iter last); 16 17 #include <algorithm> 18 #include <cassert> 19 20 #include "test_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 assert(std::adjacent_find(forward_iterator<const int*>(ia), 27 forward_iterator<const int*>(ia + sa)) == 28 forward_iterator<const int*>(ia+2)); 29 assert(std::adjacent_find(forward_iterator<const int*>(ia), 30 forward_iterator<const int*>(ia)) == 31 forward_iterator<const int*>(ia)); 32 assert(std::adjacent_find(forward_iterator<const int*>(ia+3), 33 forward_iterator<const int*>(ia + sa)) == 34 forward_iterator<const int*>(ia+sa)); 35 } 36