@@ -81,7 +81,7 @@ private:
81
81
rank_type _Counter = 0;
82
82
for (rank_type _Idx = 0; _Idx < _Rank; ++_Idx) {
83
83
if (_Static_extents[_Idx] == dynamic_extent) {
84
- _Analysis_assume_(_Counter < _Rank_dynamic); // TRANSITION, DevCom-923103
84
+ _Analysis_assume_(_Counter < _Rank_dynamic); // guaranteed by how _Rank_dynamic is calculated
85
85
_Result[_Counter] = _Idx;
86
86
++_Counter;
87
87
}
@@ -174,22 +174,22 @@ private:
174
174
}
175
175
176
176
public:
177
- _NODISCARD static constexpr rank_type rank() noexcept {
177
+ _NODISCARD _Ret_range_(==, _Rank) static constexpr rank_type rank() noexcept {
178
178
return _Rank;
179
179
}
180
180
181
181
_NODISCARD static constexpr rank_type rank_dynamic() noexcept {
182
182
return _Rank_dynamic;
183
183
}
184
184
185
- _NODISCARD static constexpr size_t static_extent(const rank_type _Idx) noexcept {
185
+ _NODISCARD static constexpr size_t static_extent(_In_range_(<, _Rank) const rank_type _Idx) noexcept {
186
186
#if _CONTAINER_DEBUG_LEVEL > 0
187
187
_STL_VERIFY(_Idx < _Rank, "Index must be less than rank() (N4950 [mdspan.extents.obs]/1)");
188
188
#endif // _CONTAINER_DEBUG_LEVEL > 0
189
189
return _Static_extents[_Idx];
190
190
}
191
191
192
- _NODISCARD constexpr index_type extent(const rank_type _Idx) const noexcept {
192
+ _NODISCARD constexpr index_type extent(_In_range_(<, _Rank) const rank_type _Idx) const noexcept {
193
193
#if _CONTAINER_DEBUG_LEVEL > 0
194
194
_STL_VERIFY(_Idx < _Rank, "Index must be less than rank() (N4950 [mdspan.extents.obs]/3)");
195
195
#endif // _CONTAINER_DEBUG_LEVEL > 0
@@ -591,7 +591,7 @@ public:
591
591
return true;
592
592
}
593
593
594
- _NODISCARD constexpr index_type stride(const rank_type _Idx) const noexcept
594
+ _NODISCARD constexpr index_type stride(_In_range_(<, extents_type::_Rank) const rank_type _Idx) const noexcept
595
595
requires (extents_type::rank() > 0)
596
596
{
597
597
#if _CONTAINER_DEBUG_LEVEL > 0
@@ -744,7 +744,7 @@ public:
744
744
return true;
745
745
}
746
746
747
- _NODISCARD constexpr index_type stride(const rank_type _Idx) const noexcept
747
+ _NODISCARD constexpr index_type stride(_In_range_(<, extents_type::_Rank) const rank_type _Idx) const noexcept
748
748
requires (extents_type::rank() > 0)
749
749
{
750
750
#if _CONTAINER_DEBUG_LEVEL > 0
@@ -975,10 +975,14 @@ public:
975
975
return true;
976
976
}
977
977
978
- _NODISCARD constexpr index_type stride(const rank_type _Idx) const noexcept {
978
+ _NODISCARD constexpr index_type stride(_In_range_(<, extents_type::_Rank) const rank_type _Idx) const noexcept {
979
979
if constexpr (extents_type::rank() == 0) {
980
980
_STL_VERIFY(false, "The argument to stride must be nonnegative and less than extents_type::rank().");
981
981
} else {
982
+ #if _CONTAINER_DEBUG_LEVEL > 0
983
+ _STL_VERIFY(_Idx < extents_type::_Rank,
984
+ "The argument to stride must be nonnegative and less than extents_type::rank().");
985
+ #endif // _CONTAINER_DEBUG_LEVEL > 0
982
986
return this->_Array[_Idx];
983
987
}
984
988
}
@@ -1187,22 +1191,22 @@ private:
1187
1191
"[mdspan.mdspan.overview]/2.3).");
1188
1192
1189
1193
public:
1190
- _NODISCARD static constexpr rank_type rank() noexcept {
1194
+ _NODISCARD _Ret_range_(==, extents_type::_Rank) static constexpr rank_type rank() noexcept {
1191
1195
return extents_type::_Rank;
1192
1196
}
1193
1197
1194
1198
_NODISCARD static constexpr rank_type rank_dynamic() noexcept {
1195
1199
return extents_type::_Rank_dynamic;
1196
1200
}
1197
1201
1198
- _NODISCARD static constexpr size_t static_extent(const rank_type _Idx) noexcept {
1202
+ _NODISCARD static constexpr size_t static_extent(_In_range_(<, extents_type::_Rank) const rank_type _Idx) noexcept {
1199
1203
#if _CONTAINER_DEBUG_LEVEL > 0
1200
1204
_STL_VERIFY(_Idx < extents_type::_Rank, "Index must be less than rank() (N4950 [mdspan.extents.obs]/1)");
1201
1205
#endif // _CONTAINER_DEBUG_LEVEL > 0
1202
1206
return extents_type::_Static_extents[_Idx];
1203
1207
}
1204
1208
1205
- _NODISCARD constexpr index_type extent(const rank_type _Idx) const noexcept {
1209
+ _NODISCARD constexpr index_type extent(_In_range_(<, extents_type::_Rank) const rank_type _Idx) const noexcept {
1206
1210
return this->_Map.extents().extent(_Idx);
1207
1211
}
1208
1212
0 commit comments