Merge commit 'ca2d9eb5349ead95bfdf1e16ce129ed3ba18261a'
All checks were successful
Build / build (push) Successful in 3m9s

This commit is contained in:
2024-09-07 00:16:03 -05:00
23 changed files with 459 additions and 120 deletions

View File

@ -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<StrCap>::resize(size_t sz) noexcept {
return {};
}
template<std::size_t StrCap>
constexpr ox::Error IString<StrCap>::unsafeResize(size_t sz) noexcept {
if (sz > StrCap) [[unlikely]] {
return OxError(1, "Trying to extend IString beyond its cap");
}
m_size = sz;
return {};
}
template<size_t sz>
struct MaybeView<ox::IString<sz>> {
using type = ox::StringView;