[libcxx-commits] [libcxx] [libc++][mdspan] P3383R3: mdspan.at() (PR #175213)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 9 21:26:09 PST 2026


================
@@ -0,0 +1,262 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// <mdspan>
+
+// template<class... OtherIndexTypes>
+//   constexpr reference at(OtherIndexTypes... indices) const;
+//
+// template<class OtherIndexType>
+//   constexpr reference at(span<OtherIndexType, rank()> indices) const;
+//
+// template<class OtherIndexType>
+//   constexpr reference at(const array<OtherIndexType, rank()>& indices) const;
+//
+// Constraints:
+//   * sizeof...(OtherIndexTypes) == extents_type::rank() is true,
+//   * (is_convertible_v<OtherIndexTypes, index_type> && ...) is true,
+//   * (is_nothrow_constructible_v<index_type, OtherIndexTypes> && ...) is true.
+//
+// Throws:
+//   * std::out_of_range if extents_type::index-cast(indices) is not a multidimensional index in extents_.
+
+#include <array>
+#include <cassert>
+#include <mdspan>
+#include <span> // dynamic_extent
+#ifndef TEST_HAS_NO_EXCEPTIONS
+#  include <vector>
+#endif
----------------
H-G-Hristov wrote:

```suggestion
#include <vector>
```
IMO, include unconditional too.


https://github.com/llvm/llvm-project/pull/175213


More information about the libcxx-commits mailing list