mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-22 07:27:59 -05:00
dont reinvent the wheel
Some checks failed
Build Binaries / Build Windows (push) Has been cancelled
Build Binaries / Build macOS (push) Has been cancelled
Build Binaries / Build Android (64-bit) (push) Has been cancelled
Build Binaries / Build Android (32-bit) (push) Has been cancelled
Build Binaries / Publish (push) Has been cancelled
Some checks failed
Build Binaries / Build Windows (push) Has been cancelled
Build Binaries / Build macOS (push) Has been cancelled
Build Binaries / Build Android (64-bit) (push) Has been cancelled
Build Binaries / Build Android (32-bit) (push) Has been cancelled
Build Binaries / Publish (push) Has been cancelled
This commit is contained in:
parent
9e82cee2bf
commit
d4ca28c51a
1 changed files with 2 additions and 1 deletions
|
@ -137,8 +137,9 @@ namespace geode {
|
|||
if constexpr (std::is_floating_point_v<Num>) res = std::from_chars(str.data(), str.data() + str.size(), result);
|
||||
else res = std::from_chars(str.data(), str.data() + str.size(), result, base);
|
||||
|
||||
auto [_, ec] = res;
|
||||
auto [ptr, ec] = res;
|
||||
if (ec == std::errc()) return Ok(result);
|
||||
else if (ptr != str.data() + str.size()) return Err("String contains trailing extra data");
|
||||
else if (ec == std::errc::invalid_argument) return Err("String is not a number");
|
||||
else if (ec == std::errc::result_out_of_range) return Err("Number is too large to fit");
|
||||
else return Err("Unknown error");
|
||||
|
|
Loading…
Reference in a new issue