[ox/std] Add missing + and += operators to Span
All checks were successful
Build / build (push) Successful in 2m38s
All checks were successful
Build / build (push) Successful in 2m38s
This commit is contained in:
parent
27f4703a9a
commit
3308b4dd72
15
deps/ox/src/ox/std/span.hpp
vendored
15
deps/ox/src/ox/std/span.hpp
vendored
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user