Debian Codegraph @

libcxx/test/std/containers/views/mdspan/default_accessor/ctor.default.pass.cpp

raw
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
10
11 // <mdspan>
12
13 // Test default construction:
14 //
15 // constexpr default_accessor() noexcept = default;
16
17 #include <mdspan>
18 #include <cassert>
19 #include <cstdint>
20 #include <type_traits>
21
22 #include "test_macros.h"
23
24 #include "../MinimalElementType.h"
25
26 template <class T>
27 constexpr void test_construction() {
28 ASSERT_NOEXCEPT(std::default_accessor<T>{});
29 [[maybe_unused]] std::default_accessor<T> acc;
30 static_assert(std::is_trivially_default_constructible_v<std::default_accessor<T>>);
31 }
32
33 constexpr bool test() {
34 test_construction<int>();
35 test_construction<const int>();
36 test_construction<MinimalElementType>();
37 test_construction<const MinimalElementType>();
38 return true;
39 }
40
41 int main(int, char**) {
42 test();
43 static_assert(test());
44 return 0;
45 }