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// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
10
11// <mdspan>
12
13// Test default construction:
14//
15// constexpr aligned_accessor() noexcept = default;
16
17#include <mdspan>
18#include <cassert>
19#include <cstddef>
20#include <type_traits>
21
22#include "test_macros.h"
23
24#include "../MinimalElementType.h"
25
26template <class T, std::size_t N>
27constexpr void test_construction() {
28 ASSERT_NOEXCEPT(std::aligned_accessor<T, N>{});
29 [[maybe_unused]] std::aligned_accessor<T, N> acc;
30 static_assert(std::is_trivially_default_constructible_v<std::aligned_accessor<T, N>>);
31}
32
33template <class T>
34constexpr void test_it() {
35 constexpr std::size_t N = alignof(T);
36 test_construction<T, N>();
37 test_construction<T, 2 * N>();
38 test_construction<T, 4 * N>();
39 test_construction<T, 8 * N>();
40 test_construction<T, 16 * N>();
41 test_construction<T, 32 * N>();
42}
43
44constexpr bool test() {
45 test_it<int>();
46 test_it<const int>();
47 test_it<MinimalElementType>();
48 test_it<const MinimalElementType>();
49 return true;
50}
51
52int main(int, char**) {
53 test();
54 static_assert(test());
55 return 0;
56}
57

source code of libcxx/test/std/containers/views/mdspan/aligned_accessor/ctor.default.pass.cpp