Reputation: 766
If I understand https://en.cppreference.com/w/cpp/container/mdspan/extents right, index_type
can be signed.
Else it would not make sense to use std::make_unsigned_t<index_type>
for size_type
.
This means I cannot expect that 0
is the lower bound of an index value.
This implies that https://en.cppreference.com/w/cpp/container/mdspan/extent
gives me the size of the extent, but does not allow me to deduce the highest index value.
So how can I find the lower and upper bound for an extent to be used in a generic function?
I have read https://en.cppreference.com/w/cpp/container/mdspan and looked into the reference implementation at https://github.com/kokkos/mdspan .
However, the documentation seems not to be ready, which is not that surprising for something still in development.
Using std::numeric_limits
does not make sense, because for unsigned integers, it would give me a number far beyond usual sizes of extents.
Upvotes: 0
Views: 72