diff options
| author | 2025-03-01 18:08:34 +0000 | |
|---|---|---|
| committer | 2025-03-02 00:57:30 +0000 | |
| commit | d3c30029dcbd04f04e61ef9cdd6322b05cc4a4d4 (patch) | |
| tree | c69c481119f05e60f3b1d721d6eb28a1cd9d3283 /include | |
| parent | Merge branch 'insp4' into master. (diff) | |
Use from_chars instead of istringstream in ConvToNum.
Diffstat (limited to 'include')
| -rw-r--r-- | include/convto.h | 3 | ||||
| -rw-r--r-- | include/inspircd.h | 1 |
2 files changed, 2 insertions, 2 deletions
diff --git a/include/convto.h b/include/convto.h index 1b8692425..ff789eacd 100644 --- a/include/convto.h +++ b/include/convto.h @@ -106,8 +106,7 @@ template<typename Numeric> inline Numeric ConvToNum(const std::string& in, Numeric def = 0) { Numeric ret; - std::istringstream tmp(in); - if (!(tmp >> ret)) + if (std::from_chars(in.data(), in.data() + in.size(), ret).ec != std::errc{}) return def; return ret; } diff --git a/include/inspircd.h b/include/inspircd.h index ccb9507aa..89f96b49c 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -38,6 +38,7 @@ #include <array> #include <atomic> #include <bitset> +#include <charconv> #include <deque> #include <functional> #include <memory> |
