[ox/std] Add pre- and post-increment operators to Span
Some checks failed
Build / build (push) Failing after 8s
Some checks failed
Build / build (push) Failing after 8s
This commit is contained in:
18
deps/ox/src/ox/std/span.hpp
vendored
18
deps/ox/src/ox/std/span.hpp
vendored
@ -163,6 +163,24 @@ class Span {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr Span operator++(int) noexcept {
|
||||||
|
++m_items;
|
||||||
|
--m_size;
|
||||||
|
if (!m_size) [[unlikely]] {
|
||||||
|
m_items = nullptr;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr Span operator++() noexcept {
|
||||||
|
++m_items;
|
||||||
|
--m_size;
|
||||||
|
if (!m_size) [[unlikely]] {
|
||||||
|
m_items = nullptr;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr auto data() const noexcept {
|
constexpr auto data() const noexcept {
|
||||||
return m_items;
|
return m_items;
|
||||||
|
Reference in New Issue
Block a user