Home | History | Annotate | Download | only in alg.find
      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 Iter, class T>
     13 //   requires HasEqualTo<Iter::value_type, T>
     14 //   Iter
     15 //   find(Iter first, Iter last, const T& value);
     16 
     17 #include <algorithm>
     18 #include <cassert>
     19 
     20 #include "test_iterators.h"
     21 
     22 int main()
     23 {
     24     int ia[] = {0, 1, 2, 3, 4, 5};
     25     const unsigned s = sizeof(ia)/sizeof(ia[0]);
     26     input_iterator<const int*> r = std::find(input_iterator<const int*>(ia),
     27                                              input_iterator<const int*>(ia+s), 3);
     28     assert(*r == 3);
     29     r = std::find(input_iterator<const int*>(ia), input_iterator<const int*>(ia+s), 10);
     30     assert(r == input_iterator<const int*>(ia+s));
     31 }
     32