diff options
Diffstat (limited to 'sord')
-rw-r--r-- | sord/sordmm.hpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/sord/sordmm.hpp b/sord/sordmm.hpp index 8e352d4..cbb5460 100644 --- a/sord/sordmm.hpp +++ b/sord/sordmm.hpp @@ -330,24 +330,16 @@ inline int Node::to_int() const { assert(is_int()); - std::locale c_locale("C"); - std::stringstream ss((const char*)sord_node_get_string(_c_obj)); - ss.imbue(c_locale); - int i = 0; - ss >> i; - return i; + char* endptr; + return strtol((const char*)sord_node_get_string(_c_obj), &endptr, 10); } inline float Node::to_float() const { assert(is_float()); - std::locale c_locale("C"); - std::stringstream ss((const char*)sord_node_get_string(_c_obj)); - ss.imbue(c_locale); - float f = 0.0f; - ss >> f; - return f; + char* endptr; + return serd_strtod((const char*)sord_node_get_string(_c_obj), &endptr); } inline bool |