diff --git a/include/utils.hpp b/include/utils.hpp index 8f8bd79..e765aad 100644 --- a/include/utils.hpp +++ b/include/utils.hpp @@ -1,11 +1,10 @@ #ifndef UTILS_HPP #define UTILS_HPP - +#include #include #include #include -#include #include namespace utils { @@ -39,9 +38,12 @@ inline void fastReadNum(const std::string& path, char (&buf)[N], T& result) { } inline std::string pNum(const auto num, const uint8_t decs = 0) { - return std::format("{:.{}f}", num, decs); + static std::array buf; + auto [ptr, ec] = std::to_chars(buf.data(), buf.data() + buf.size(), num, std::chars_format::fixed, decs); + return std::string(buf.data(), ptr); } + inline bool fileExists(const std::string_view& path) { return std::filesystem::exists(path); }