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 // <numeric> 11 12 // template <class ForwardIterator, class T> 13 // void iota(ForwardIterator first, ForwardIterator last, T value); 14 15 #include <numeric> 16 #include <cassert> 17 18 #include "test_iterators.h" 19 20 template <class InIter> 21 void 22 test() 23 { 24 int ia[] = {1, 2, 3, 4, 5}; 25 int ir[] = {5, 6, 7, 8, 9}; 26 const unsigned s = sizeof(ia) / sizeof(ia[0]); 27 std::iota(InIter(ia), InIter(ia+s), 5); 28 for (unsigned i = 0; i < s; ++i) 29 assert(ia[i] == ir[i]); 30 } 31 32 int main() 33 { 34 test<forward_iterator<int*> >(); 35 test<bidirectional_iterator<int*> >(); 36 test<random_access_iterator<int*> >(); 37 test<int*>(); 38 } 39