From c223b70d2d549b4f7480e6dbfa634eb2cc7a73cf Mon Sep 17 00:00:00 2001 From: conrad Date: Wed, 17 Nov 2021 15:17:44 +1000 Subject: [PATCH] handle tokens stating with '.' --- include/armadillo_bits/diskio_meat.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/armadillo_bits/diskio_meat.hpp b/include/armadillo_bits/diskio_meat.hpp index 61738ae4..f6b8e6bb 100644 --- a/include/armadillo_bits/diskio_meat.hpp +++ b/include/armadillo_bits/diskio_meat.hpp @@ -463,6 +463,17 @@ diskio::convert_token(eT& val, const std::string& token) { // signed integer + if((str[0] == '.') && (N >= 2)) + { + const char* str_offset1 = &(str[1]); + + std::strtoll(str_offset1, &endptr, 10); + + if(str_offset1 == endptr) { return false; } + + val = eT(0); return true; + } + val = eT( std::strtoll(str, &endptr, 10) ); } else