Factor out common code from readString and appendStringLiteral

This commit is contained in:
Rangi42
2025-07-11 22:18:31 -04:00
parent e7a05b1db8
commit 01a5c94c7e
2 changed files with 144 additions and 185 deletions

View File

@@ -224,7 +224,7 @@ static bool readLine(std::filebuf &file, std::string &buffer) {
template<typename U> // Should be uint*_t
static std::optional<U> parseDec(std::string const &str, size_t &n) {
uintmax_t value = 0;
auto result = std::from_chars(str.data() + n, str.data() + str.size(), value);
auto result = std::from_chars(str.data() + n, str.data() + str.length(), value);
if (static_cast<bool>(result.ec)) {
return std::nullopt;
}