Temporarily disable use of std::from_chars and <charconv>

On CentOS7, the include of <charconv> seems not to be present. Use previous conversion method for now.
This commit is contained in:
Magne Sjaastad 2021-10-15 17:28:08 +02:00
parent ae7139e18d
commit 70a11e7fc3
2 changed files with 7 additions and 5 deletions

View File

@ -21,7 +21,6 @@
#include "fast_float/include/fast_float/fast_float.h" #include "fast_float/include/fast_float/fast_float.h"
#include <cctype> #include <cctype>
#include <charconv>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -123,11 +122,14 @@ bool RiaStdStringTools::toDouble( const std::string_view& s, double& value )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaStdStringTools::toInt( const std::string_view& s, int& value ) bool RiaStdStringTools::toInt( const std::string& s, int& value )
{ {
auto resultObject = std::from_chars( s.data(), s.data() + s.size(), value ); // auto resultObject = std::from_chars( s.data(), s.data() + s.size(), value );
// return ( resultObject.ec == std::errc() );
return ( resultObject.ec == std::errc() ); value = toInt( s );
return true;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -41,7 +41,7 @@ public:
// Conversion using fastest known approach // Conversion using fastest known approach
static bool toDouble( const std::string_view& s, double& value ); static bool toDouble( const std::string_view& s, double& value );
static bool toInt( const std::string_view& s, int& value ); static bool toInt( const std::string& s, int& value );
static std::string toUpper( const std::string& s ); static std::string toUpper( const std::string& s );