[libcxx] Add mdspan/extents
authorChristian Trott <crtrott@sandia.gov>
Tue, 16 May 2023 19:38:11 +0000 (12:38 -0700)
committerNikolas Klauser <n_klauser@apple.com>
Tue, 16 May 2023 21:30:36 +0000 (14:30 -0700)
commitfcaccf817d31d39096f7d0e7014cd6fe2fa3a683
tree67d65b900fad74702b04de276fb2f24913cad5c6
parent02a029f7fb5a3feae60759eab6a528880e341358
[libcxx] Add mdspan/extents

This patch adds std::extents. extents is one of the core classes used by std::mdspan. It describes a multi-dimensional index space with a mix of compile time and runtime sizes. Furthermore, it is templated on the index type used to describe the multi-dimensional index space.

The class is designed to be highly optimizable in performance critical code sections, and is fully useable in constant expressions contexts.

Testing of this class tends to be somewhat combinatorical, due to the large number of possible corner cases involved in situations where we have both runtime and compile time extents. To add to this, the class is designed to be interoperable (in particular constructible) from arguments which only need to be convertible to the index_type, but are otherwise arbitrary user types. For a larger discussion on the design of this class refer to: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0009r18.html

Co-authored-by: Damien L-G <dalg24@gmail.com>
Reviewed By: ldionne, #libc

Spies: libcxx-commits, H-G-Hristov, tschuett, philnik, arichardson, Mordante, crtrott

Differential Revision: https://reviews.llvm.org/D148067
44 files changed:
libcxx/CREDITS.TXT
libcxx/docs/FeatureTestMacroTable.rst
libcxx/docs/Status/Cxx2bPapers.csv
libcxx/include/CMakeLists.txt
libcxx/include/__mdspan/extents.h [new file with mode: 0644]
libcxx/include/libcxx.imp
libcxx/include/mdspan [new file with mode: 0644]
libcxx/include/module.modulemap.in
libcxx/include/version
libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp
libcxx/test/libcxx/clang_tidy.sh.cpp
libcxx/test/libcxx/double_include.sh.cpp
libcxx/test/libcxx/min_max_macros.compile.pass.cpp
libcxx/test/libcxx/modules_include.sh.cpp
libcxx/test/libcxx/nasty_macros.compile.pass.cpp
libcxx/test/libcxx/no_assert_include.compile.pass.cpp
libcxx/test/libcxx/private_headers.verify.cpp
libcxx/test/libcxx/transitive_includes.sh.cpp
libcxx/test/libcxx/transitive_includes/cxx03.csv
libcxx/test/libcxx/transitive_includes/cxx11.csv
libcxx/test/libcxx/transitive_includes/cxx14.csv
libcxx/test/libcxx/transitive_includes/cxx17.csv
libcxx/test/libcxx/transitive_includes/cxx20.csv
libcxx/test/libcxx/transitive_includes/cxx2b.csv
libcxx/test/std/containers/views/mdspan/extents/ConvertibleToIntegral.h [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/assert.conversion.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/assert.obs.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/comparison.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/conversion.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/ctad.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/ctor_default.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/ctor_from_array.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/ctor_from_integral.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/ctor_from_span.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/dextents.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/views/mdspan/extents/types.pass.cpp [new file with mode: 0644]
libcxx/test/std/language.support/support.limits/support.limits.general/mdspan.version.compile.pass.cpp [new file with mode: 0644]
libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
libcxx/utils/generate_feature_test_macro_components.py