Skip to content

Commit 735f35f

Browse files
committed
Implement P2821R5: Adding span::at()
1 parent 142164e commit 735f35f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

stl/inc/span

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,16 @@ public:
495495
#endif // ^^^ _ITERATOR_DEBUG_LEVEL == 0 ^^^
496496
}
497497

498+
#if _HAS_CXX26
499+
_NODISCARD constexpr reference at(size_type _Off) const {
500+
if (_Off < _Mysize) {
501+
_Xrange();
502+
}
503+
504+
return _Mydata[_Off];
505+
}
506+
#endif
507+
498508
#if _HAS_CXX23
499509
_NODISCARD constexpr const_iterator cbegin() const noexcept {
500510
return begin();

0 commit comments

Comments
 (0)