diff --git a/deps/ox/src/ox/std/istring.hpp b/deps/ox/src/ox/std/istring.hpp index 7ffee5e4..83dea255 100644 --- a/deps/ox/src/ox/std/istring.hpp +++ b/deps/ox/src/ox/std/istring.hpp @@ -81,6 +81,11 @@ class IString { constexpr ox::Error resize(size_t sz) noexcept; + /** + * Resizes without clearing memory between current end and new end. + */ + constexpr ox::Error unsafeResize(size_t sz) noexcept; + /** * Returns the capacity of bytes for this string. */ @@ -220,6 +225,15 @@ constexpr ox::Error IString::resize(size_t sz) noexcept { return {}; } +template +constexpr ox::Error IString::unsafeResize(size_t sz) noexcept { + if (sz > StrCap) [[unlikely]] { + return OxError(1, "Trying to extend IString beyond its cap"); + } + m_size = sz; + return {}; +} + template struct MaybeView> { using type = ox::StringView;