From c3cf6df863828798ed8230b0f0966bcf3b2d08dd Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Sun, 27 Oct 2024 21:50:16 -0500 Subject: Excise std::optional. --- include/fud_string.hpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'include/fud_string.hpp') diff --git a/include/fud_string.hpp b/include/fud_string.hpp index df03ad9..d2d3761 100644 --- a/include/fud_string.hpp +++ b/include/fud_string.hpp @@ -20,10 +20,11 @@ #include "fud_allocator.hpp" #include "fud_assert.hpp" +#include "fud_c_string.hpp" +#include "fud_option.hpp" #include "fud_result.hpp" #include "fud_status.hpp" #include "fud_string_view.hpp" -#include "fud_c_string.hpp" #include "fud_utf8.hpp" #include @@ -65,7 +66,7 @@ class String { Array lengths{}; Array strPointers{}; size_t index = 0; - for (const auto* cStringItem: {cStrings...}) { + for (const auto* cStringItem : {cStrings...}) { const char* cString = nullptr; if constexpr (std::is_same_v) { cString = cStringItem; @@ -106,7 +107,11 @@ class String { size_t cumulativeLength = 0; for (size_t idx = 0; idx < strPointers.size(); ++idx) { const auto* cString = strPointers[idx]; - auto copyStatus = copyMem(data + cumulativeLength, output.m_capacity - cumulativeLength, cString, lengths[idx]); + auto copyStatus = copyMem( + data + cumulativeLength, + output.m_capacity - cumulativeLength, + cString, + lengths[idx]); fudAssert(copyStatus == FudStatus::Success); cumulativeLength += lengths[idx]; } @@ -189,7 +194,7 @@ class String { FudStatus reserve(size_t newCapacity); - [[nodiscard]] std::optional back(); + [[nodiscard]] Option back(); [[nodiscard]] constexpr size_t remainingLength() const { @@ -211,7 +216,7 @@ class String { FudStatus pushBack(const FudUtf8& letter); - std::optional pop(); + Option pop(); FudStatus append(const char* source); -- cgit v1.2.3