1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // template<ForwardIterator Iter, class T>
12 // requires OutputIterator<Iter, const T&>
13 // constexpr void // constexpr after C++17
14 // fill(Iter first, Iter last, const T& value);
19 #include "test_macros.h"
20 #include "test_iterators.h"
23 TEST_CONSTEXPR
bool test_constexpr() {
24 int ia
[] = {0, 1, 2, 3, 4};
26 std::fill(std::begin(ia
), std::end(ia
), 5);
28 return std::all_of(std::begin(ia
), std::end(ia
), [](int a
) {return a
== 5; })
39 std::fill(Iter(ca
), Iter(ca
+n
), char(1));
52 std::fill(Iter(ia
), Iter(ia
+n
), 1);
61 test_char
<forward_iterator
<char*> >();
62 test_char
<bidirectional_iterator
<char*> >();
63 test_char
<random_access_iterator
<char*> >();
66 test_int
<forward_iterator
<int*> >();
67 test_int
<bidirectional_iterator
<int*> >();
68 test_int
<random_access_iterator
<int*> >();
72 static_assert(test_constexpr());