Skip to content

Commit

Permalink
Cast to index_type before checking negative indicies in at()
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanlachnit committed Nov 18, 2024
1 parent 1da58f6 commit efea5cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/experimental/__p0009_bits/mdspan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ class mdspan
)
MDSPAN_FORCE_INLINE_FUNCTION constexpr bool __is_index_oor(SizeType index, index_type extent) const noexcept {
// Check for negative indices
if constexpr(std::is_signed_v<SizeType>) {
if(index < 0) {
if constexpr (std::is_signed_v<index_type>) {
if (static_cast<index_type>(index) < 0) {
return true;
}
}
Expand Down

0 comments on commit efea5cb

Please sign in to comment.