//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // template OutIter> // requires HasMinus // && Constructible // && OutputIterator::result_type> // && MoveAssignable // OutIter // adjacent_difference(InIter first, InIter last, OutIter result); #include #include #include "../iterators.h" template void test() { int ia[] = {15, 10, 6, 3, 1}; int ir[] = {15, -5, -4, -3, -2}; const unsigned s = sizeof(ia) / sizeof(ia[0]); int ib[s] = {0}; OutIter r = std::adjacent_difference(InIter(ia), InIter(ia+s), OutIter(ib)); assert(base(r) == ib + s); for (unsigned i = 0; i < s; ++i) assert(ib[i] == ir[i]); } int main() { test, output_iterator >(); test, forward_iterator >(); test, bidirectional_iterator >(); test, random_access_iterator >(); test, int*>(); test, output_iterator >(); test, forward_iterator >(); test, bidirectional_iterator >(); test, random_access_iterator >(); test, int*>(); test, output_iterator >(); test, forward_iterator >(); test, bidirectional_iterator >(); test, random_access_iterator >(); test, int*>(); test, output_iterator >(); test, forward_iterator >(); test, bidirectional_iterator >(); test, random_access_iterator >(); test, int*>(); test >(); test >(); test >(); test >(); test(); }