1*4684ddb6SLionel Sambuc //===----------------------------------------------------------------------===//
2*4684ddb6SLionel Sambuc //
3*4684ddb6SLionel Sambuc // The LLVM Compiler Infrastructure
4*4684ddb6SLionel Sambuc //
5*4684ddb6SLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open
6*4684ddb6SLionel Sambuc // Source Licenses. See LICENSE.TXT for details.
7*4684ddb6SLionel Sambuc //
8*4684ddb6SLionel Sambuc //===----------------------------------------------------------------------===//
9*4684ddb6SLionel Sambuc
10*4684ddb6SLionel Sambuc // <numeric>
11*4684ddb6SLionel Sambuc
12*4684ddb6SLionel Sambuc // template <class ForwardIterator, class T>
13*4684ddb6SLionel Sambuc // void iota(ForwardIterator first, ForwardIterator last, T value);
14*4684ddb6SLionel Sambuc
15*4684ddb6SLionel Sambuc #include <numeric>
16*4684ddb6SLionel Sambuc #include <cassert>
17*4684ddb6SLionel Sambuc
18*4684ddb6SLionel Sambuc #include "test_iterators.h"
19*4684ddb6SLionel Sambuc
20*4684ddb6SLionel Sambuc template <class InIter>
21*4684ddb6SLionel Sambuc void
test()22*4684ddb6SLionel Sambuc test()
23*4684ddb6SLionel Sambuc {
24*4684ddb6SLionel Sambuc int ia[] = {1, 2, 3, 4, 5};
25*4684ddb6SLionel Sambuc int ir[] = {5, 6, 7, 8, 9};
26*4684ddb6SLionel Sambuc const unsigned s = sizeof(ia) / sizeof(ia[0]);
27*4684ddb6SLionel Sambuc std::iota(InIter(ia), InIter(ia+s), 5);
28*4684ddb6SLionel Sambuc for (unsigned i = 0; i < s; ++i)
29*4684ddb6SLionel Sambuc assert(ia[i] == ir[i]);
30*4684ddb6SLionel Sambuc }
31*4684ddb6SLionel Sambuc
main()32*4684ddb6SLionel Sambuc int main()
33*4684ddb6SLionel Sambuc {
34*4684ddb6SLionel Sambuc test<forward_iterator<int*> >();
35*4684ddb6SLionel Sambuc test<bidirectional_iterator<int*> >();
36*4684ddb6SLionel Sambuc test<random_access_iterator<int*> >();
37*4684ddb6SLionel Sambuc test<int*>();
38*4684ddb6SLionel Sambuc }
39