#include #include #include #include struct large_num_config { using comment_type = toml::preserve_comments; using boolean_type = bool; using integer_type = boost::multiprecision::cpp_int; using floating_type = boost::multiprecision::cpp_bin_float_oct; using string_type = std::string; template using array_type = std::vector; template using table_type = std::unordered_map; static toml::result parse_int(const std::string& str, const toml::source_location src, const std::uint8_t base) { return toml::read_int(str, src, base); } static toml::result parse_float(const std::string& str, const toml::source_location src, const bool is_hex) { return toml::read_float(str, src, is_hex); } }; int main() { const std::string input_str(R"( large_int_dec = 10_000_000_000_000_000_000 large_int_hex = 0x0001_0000_0000_0000_0000 large_float_pi = 3.1415926535897932384626433832795028842 )"); const auto input = toml::parse_str(input_str); std::cout << "int64_t max = " << (std::numeric_limits::max)() << std::endl; std::cout << "large_int_dec = " << input.at("large_int_dec" ).as_integer() << std::endl; std::cout << "large_int_hex = " << input.at("large_int_hex" ).as_integer() << std::endl; std::cout << "large_float_pi = " << std::setprecision(std::numeric_limits::max_digits10 - 1) << input.at("large_float_pi").as_floating() << std::endl; std::cout << "=================" << std::endl; std::cout << toml::format(input) << std::endl; return 0; }