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 // namespace std { 14 // template<class Extents> 15 // class layout_right::mapping { 16 // 17 // ... 18 // static constexpr bool is_always_unique() noexcept { return true; } 19 // static constexpr bool is_always_exhaustive() noexcept { return true; } 20 // static constexpr bool is_always_strided() noexcept { return true; } 21 // 22 // static constexpr bool is_unique() noexcept { return true; } 23 // static constexpr bool is_exhaustive() noexcept { return true; } 24 // static constexpr bool is_strided() noexcept { return true; } 25 // ... 26 // }; 27 // } 28 29 #include <mdspan> 30 #include <type_traits> 31 #include <concepts> 32 #include <cassert> 33 34 #include "test_macros.h" 35 36 template <class E> 37 constexpr void test_layout_mapping_right() { 38 using M = std::layout_right::template mapping<E>; 39 assert(M::is_unique() == true); 40 assert(M::is_exhaustive() == true); 41 assert(M::is_strided() == true); 42 assert(M::is_always_unique() == true); 43 assert(M::is_always_exhaustive() == true); 44 assert(M::is_always_strided() == true); 45 ASSERT_NOEXCEPT(std::declval<M>().is_unique()); 46 ASSERT_NOEXCEPT(std::declval<M>().is_exhaustive()); 47 ASSERT_NOEXCEPT(std::declval<M>().is_strided()); 48 ASSERT_NOEXCEPT(M::is_always_unique()); 49 ASSERT_NOEXCEPT(M::is_always_exhaustive()); 50 ASSERT_NOEXCEPT(M::is_always_strided()); 51 } 52 53 constexpr bool test() { 54 constexpr size_t D = std::dynamic_extent; 55 test_layout_mapping_right<std::extents<int>>(); 56 test_layout_mapping_right<std::extents<char, 4, 5>>(); 57 test_layout_mapping_right<std::extents<unsigned, D, 4>>(); 58 test_layout_mapping_right<std::extents<size_t, D, D, D, D>>(); 59 return true; 60 } 61 62 int main(int, char**) { 63 test(); 64 static_assert(test()); 65 return 0; 66 } 67