diff --git a/iguana/xml.hpp b/iguana/xml.hpp index 9ce30a51..da1a4607 100644 --- a/iguana/xml.hpp +++ b/iguana/xml.hpp @@ -3,7 +3,6 @@ #include #include #include -#include #include "reflection.hpp" #define IGUANA_XML_READER_CHECK_FORWARD if (l > length) return 0; work_ptr += l; length -= l @@ -91,11 +90,27 @@ namespace iguana { namespace xml return l; } + template + constexpr bool is_64_v = std::is_same_v||std::is_same_v; + template inline auto get_value(char const* str, size_t length, T& value) -> std::enable_if_t::value> { - value = boost::lexical_cast(str, length); + using U = std::remove_const_t>; + if constexpr(std::is_integral_v&&!detail::is_64_v){ + value = std::atoi(str); + } + else if constexpr(std::is_floating_point_v){ + value = std::atof(str); + } + else if constexpr(detail::is_64_v){ + value = std::atoll(str); + } + else{ + std::cout<<"don't support the type now"< + constexpr bool is_64_v = std::is_same_v||std::is_same_v; + template - auto get_value(char const* str, size_t length, T& value) + inline auto get_value(char const* str, size_t length, T& value) -> std::enable_if_t::value> { - value = boost::lexical_cast(str, length); + using U = std::remove_const_t>; + if constexpr(std::is_integral_v&&!detail::is_64_v){ + value = std::atoi(str); + } + else if constexpr(std::is_floating_point_v){ + value = std::atof(str); + } + else if constexpr(detail::is_64_v){ + value = std::atoll(str); + } + else{ + std::cout<<"don't support the type now"<