From 18bb50626d38c1dca2e01e3a8127eb36f5c23e97 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 3 May 2024 00:07:03 -0500 Subject: [PATCH] [ox/std] Add String::append(StringView), cleanup --- deps/ox/src/ox/std/fmt.hpp | 4 ++-- deps/ox/src/ox/std/string.hpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/deps/ox/src/ox/std/fmt.hpp b/deps/ox/src/ox/std/fmt.hpp index 2bc21a89..c3579e45 100644 --- a/deps/ox/src/ox/std/fmt.hpp +++ b/deps/ox/src/ox/std/fmt.hpp @@ -195,9 +195,9 @@ constexpr StringType sfmt(StringView fmt, Args&&... args) noexcept { std::ignore = out.append(firstSegment.str, firstSegment.length); const detail::FmtArg elements[sizeof...(args)] = {args...}; for (size_t i = 0; i < fmtSegments.size - 1; ++i) { - std::ignore = out.append(elements[i].out.data(), elements[i].out.len()); + std::ignore = out.append(elements[i].out); const auto &s = fmtSegments.segments[i + 1]; - std::ignore = out.append(s.str, s.length); + std::ignore = out.append(s.str); } return out; } diff --git a/deps/ox/src/ox/std/string.hpp b/deps/ox/src/ox/std/string.hpp index c3908681..7448934f 100644 --- a/deps/ox/src/ox/std/string.hpp +++ b/deps/ox/src/ox/std/string.hpp @@ -178,6 +178,10 @@ class BasicString { return OxError(0); } + constexpr Error append(ox::StringView sv) noexcept { + return append(sv.data(), sv.len()); + } + [[nodiscard]] constexpr BasicString substr(std::size_t pos) const noexcept;