minix/external/bsd/libc++/dist/libcxx/test/numerics/numeric.ops/numeric.iota/iota.pass.cpp
Lionel Sambuc 4684ddb6aa LLVM Minix changes
- import libcxx
 - reduce targets to the one when compiled as a tools

Change-Id: Iabb8427f80ff8e89463559a28bcb8b4f2bdbc496
2014-07-28 17:05:59 +02:00

38 lines
982 B
C++

//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <numeric>
// template <class ForwardIterator, class T>
// void iota(ForwardIterator first, ForwardIterator last, T value);
#include <numeric>
#include <cassert>
#include "test_iterators.h"
template <class InIter>
void
test()
{
int ia[] = {1, 2, 3, 4, 5};
int ir[] = {5, 6, 7, 8, 9};
const unsigned s = sizeof(ia) / sizeof(ia[0]);
std::iota(InIter(ia), InIter(ia+s), 5);
for (unsigned i = 0; i < s; ++i)
assert(ia[i] == ir[i]);
}
int main()
{
test<forward_iterator<int*> >();
test<bidirectional_iterator<int*> >();
test<random_access_iterator<int*> >();
test<int*>();
}