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//===----------------------------------------------------------------------===//
8
9// <array>
10
11// void fill(const T& u);
12
13#include <array>
14#include <cassert>
15
16#include "test_macros.h"
17
18TEST_CONSTEXPR_CXX20 bool tests()
19{
20 {
21 typedef double T;
22 typedef std::array<T, 3> C;
23 C c = {1, 2, 3.5};
24 c.fill(5.5);
25 assert(c.size() == 3);
26 assert(c[0] == 5.5);
27 assert(c[1] == 5.5);
28 assert(c[2] == 5.5);
29 }
30
31 {
32 typedef double T;
33 typedef std::array<T, 0> C;
34 C c = {};
35 c.fill(5.5);
36 assert(c.size() == 0);
37 }
38 return true;
39}
40
41int main(int, char**)
42{
43 tests();
44#if TEST_STD_VER >= 20
45 static_assert(tests(), "");
46#endif
47 return 0;
48}
49

source code of libcxx/test/std/containers/sequences/array/array.fill/fill.pass.cpp