Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / numerics / numeric.ops / numeric.iota / iota.pass.cpp
blob8cb49b123faf9962399034dbb02ad651aa520b17
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <numeric>
11 // Became constexpr in C++20
12 // template <class ForwardIterator, class T>
13 // void iota(ForwardIterator first, ForwardIterator last, T value);
15 #include <numeric>
16 #include <cassert>
18 #include "test_macros.h"
19 #include "test_iterators.h"
21 template <class InIter>
22 TEST_CONSTEXPR_CXX20 void
23 test()
25 int ia[] = {1, 2, 3, 4, 5};
26 int ir[] = {5, 6, 7, 8, 9};
27 const unsigned s = sizeof(ia) / sizeof(ia[0]);
28 std::iota(InIter(ia), InIter(ia+s), 5);
29 for (unsigned i = 0; i < s; ++i)
30 assert(ia[i] == ir[i]);
33 TEST_CONSTEXPR_CXX20 bool
34 test()
36 test<forward_iterator<int*> >();
37 test<bidirectional_iterator<int*> >();
38 test<random_access_iterator<int*> >();
39 test<int*>();
41 return true;
44 int main(int, char**)
46 test();
47 #if TEST_STD_VER > 17
48 static_assert(test());
49 #endif
50 return 0;