[ox/std] Add overflow checking to SpanIterator
All checks were successful
Build / build (push) Successful in 2m36s
All checks were successful
Build / build (push) Successful in 2m36s
This commit is contained in:
parent
df44fe235b
commit
114f5c6685
4
deps/ox/src/ox/std/iterator.hpp
vendored
4
deps/ox/src/ox/std/iterator.hpp
vendored
@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "error.hpp"
|
||||
#include "math.hpp"
|
||||
|
||||
#if !__has_include(<iterator>)
|
||||
@ -129,14 +130,17 @@ struct SpanIterator {
|
||||
}
|
||||
|
||||
constexpr PtrType operator->() const noexcept {
|
||||
ox::primitiveAssert(__FILE__, __LINE__, m_offset < m_max, "SpanIterator access overflow");
|
||||
return &m_t[m_offset];
|
||||
}
|
||||
|
||||
constexpr RefType operator*() const noexcept {
|
||||
ox::primitiveAssert(__FILE__, __LINE__, m_offset < m_max, "SpanIterator access overflow");
|
||||
return m_t[m_offset];
|
||||
}
|
||||
|
||||
constexpr RefType operator[](std::size_t s) const noexcept {
|
||||
ox::primitiveAssert(__FILE__, __LINE__, s < m_max, "SpanIterator access overflow");
|
||||
return m_t[s];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user