//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // template Op> // requires OutputIterator && CopyConstructible // OutIter // transform(InIter first, InIter last, OutIter result, Op op); #include #include #include #include "../../iterators.h" template void test() { int ia[] = {0, 1, 2, 3, 4}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[sa] = {0}; OutIter r = std::transform(InIter(ia), InIter(ia+sa), OutIter(ib), std::bind2nd(std::plus(), 1)); assert(base(r) == ib + sa); assert(ib[0] == 1); assert(ib[1] == 2); assert(ib[2] == 3); assert(ib[3] == 4); assert(ib[4] == 5); } int main() { test, output_iterator >(); test, input_iterator >(); test, forward_iterator >(); test, bidirectional_iterator >(); test, random_access_iterator >(); test, int*>(); test, output_iterator >(); test, input_iterator >(); test, forward_iterator >(); test, bidirectional_iterator >(); test, random_access_iterator >(); test, int*>(); test, output_iterator >(); test, input_iterator >(); test, forward_iterator >(); test, bidirectional_iterator >(); test, random_access_iterator >(); test, int*>(); test, output_iterator >(); test, input_iterator >(); test, forward_iterator >(); test, bidirectional_iterator >(); test, random_access_iterator >(); test, int*>(); test >(); test >(); test >(); test >(); test >(); test(); }