[ox/std] Add String::append(StringView), cleanup
All checks were successful
Build / build (push) Successful in 2m30s

This commit is contained in:
Gary Talent 2024-05-03 00:07:03 -05:00
parent 6a4b48221f
commit 18bb50626d
2 changed files with 6 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;