kokkos / mdspan

Reference implementation of mdspan targeting C++23
Other
406 stars 69 forks source link

mdspan: Add optional bounds checking #181

Open mhoemmen opened 2 years ago

mhoemmen commented 2 years ago

Both default_accessor and layout_{left, right, stride}::mapping::operator() have in-bounds access as a precondition. This permits implementations to add bounds checking, using whatever mechanism they like (as precondition violations are undefined behavior).

leha-bot commented 1 year ago

I think that we may additionally add the .at() method , like in std::vector, and, possibly, some kind of explicit bound checks method like item_in_range(Index... Idx)

I also may cook a proposal with this feature 😅