brintos

brintos / llvm-project-archived public Read only

0
0
Text · 960 B · 2bdb01f Raw
47 lines · cpp
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-exception6//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    typedef double T;21    typedef std::array<T, 3> C;22    C c = {1, 2, 3.5};23    c.fill(5.5);24    assert(c.size() == 3);25    assert(c[0] == 5.5);26    assert(c[1] == 5.5);27    assert(c[2] == 5.5);28  }29 30  {31    typedef double T;32    typedef std::array<T, 0> C;33    C c = {};34    c.fill(5.5);35    assert(c.size() == 0);36  }37  return true;38}39 40int main(int, char**) {41  tests();42#if TEST_STD_VER >= 2043  static_assert(tests(), "");44#endif45  return 0;46}47