40 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// UNSUPPORTED: c++03, c++11, c++14, c++17, c++209 10// <mdspan>11 12// template<class IndexType, size_t Rank>13// using dextents = see below;14//15// Result: A type E that is a specialization of extents such that16// E::rank() == Rank && E::rank() == E::rank_dynamic() is true,17// and E::index_type denotes IndexType.18 19#include <mdspan>20#include <cstddef>21 22#include "test_macros.h"23 24template <class IndexType>25void test_alias_template_dextents() {26 constexpr size_t D = std::dynamic_extent;27 ASSERT_SAME_TYPE(std::dextents<IndexType, 0>, std::extents<IndexType>);28 ASSERT_SAME_TYPE(std::dextents<IndexType, 1>, std::extents<IndexType, D>);29 ASSERT_SAME_TYPE(std::dextents<IndexType, 2>, std::extents<IndexType, D, D>);30 ASSERT_SAME_TYPE(std::dextents<IndexType, 3>, std::extents<IndexType, D, D, D>);31 ASSERT_SAME_TYPE(std::dextents<IndexType, 9>, std::extents<IndexType, D, D, D, D, D, D, D, D, D>);32}33 34int main(int, char**) {35 test_alias_template_dextents<int>();36 test_alias_template_dextents<unsigned int>();37 test_alias_template_dextents<size_t>();38 return 0;39}40