Home | History | Annotate | Download | only in alg.equal
      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, InputIterator Iter2,
     13 //          Predicate<auto, Iter1::value_type, Iter2::value_type> Pred>
     14 //   requires CopyConstructible<Pred>
     15 //   bool
     16 //   equal(Iter1 first1, Iter1 last1, Iter2 first2, Pred pred);
     17 
     18 #include <algorithm>
     19 #include <functional>
     20 #include <cassert>
     21 
     22 #include "test_iterators.h"
     23 
     24 int main()
     25 {
     26     int ia[] = {0, 1, 2, 3, 4, 5};
     27     const unsigned s = sizeof(ia)/sizeof(ia[0]);
     28     int ib[s] = {0, 1, 2, 5, 4, 5};
     29     assert(std::equal(input_iterator<const int*>(ia),
     30                       input_iterator<const int*>(ia+s),
     31                       input_iterator<const int*>(ia),
     32                       std::equal_to<int>()));
     33     assert(!std::equal(input_iterator<const int*>(ia),
     34                        input_iterator<const int*>(ia+s),
     35                        input_iterator<const int*>(ib),
     36                        std::equal_to<int>()));
     37 }
     38