diff --git a/deps/ox/src/ox/std/span.hpp b/deps/ox/src/ox/std/span.hpp index a5def89e..67a47c48 100644 --- a/deps/ox/src/ox/std/span.hpp +++ b/deps/ox/src/ox/std/span.hpp @@ -116,6 +116,7 @@ class SpanView { } constexpr SpanView operator+=(size_t i) noexcept { + ox::primitiveAssert(__FILE__, __LINE__, i < size(), "Span access overflow"); m_items += i; m_size -= i; return *this; @@ -143,7 +144,7 @@ class Span { private: T *m_items{}; - const std::size_t m_size{}; + std::size_t m_size{}; public: using value_type = T; @@ -243,6 +244,18 @@ class Span { return m_items[i]; } + constexpr Span operator+(size_t i) const noexcept { + ox::primitiveAssert(__FILE__, __LINE__, i < size(), "Span access overflow"); + return {m_items + i, m_size - i}; + } + + constexpr Span operator+=(size_t i) noexcept { + ox::primitiveAssert(__FILE__, __LINE__, i < size(), "Span access overflow"); + m_items += i; + m_size -= i; + return *this; + } + [[nodiscard]] constexpr auto data() const noexcept { return m_items;