From fbf49ba5117d9f79667222374edbb24b6137c517 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 26 Jul 2025 18:31:55 -0500 Subject: [PATCH] [ox/std] Add pre- and post-increment operators to Span --- deps/ox/src/ox/std/span.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/deps/ox/src/ox/std/span.hpp b/deps/ox/src/ox/std/span.hpp index 871dd882..381e83eb 100644 --- a/deps/ox/src/ox/std/span.hpp +++ b/deps/ox/src/ox/std/span.hpp @@ -163,6 +163,24 @@ class Span { 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]] constexpr auto data() const noexcept { return m_items;