2020#define USE_EXPR_CACHE
2121
2222#include < algorithm>
23- #include < charconv>
2423#include < cmath>
2524#include < cctype>
2625#include < clocale>
4544#include " Module.hpp"
4645#include " Debug.hpp"
4746
47+ #ifdef USE_BOOST_CHARCONV
48+
49+ #include < boost/charconv.hpp>
50+ using boost::charconv::from_chars;
51+
52+ #else
53+
54+ #include < charconv>
55+ using std::from_chars;
56+
57+ #endif
58+
4859namespace {
4960
5061#define LANES 8
@@ -288,7 +299,7 @@ ExprOp decodeToken(const std::string &token, bool extended = false)
288299 return name[0 ] >= ' x' ? name[0 ] - ' x' : name[0 ] - ' a' + 3 ;
289300 int idx = -1 ;
290301
291- auto result = std:: from_chars (name.c_str () + clipNamePrefix.size (), name.c_str () + name.length (), idx);
302+ auto result = from_chars (name.c_str () + clipNamePrefix.size (), name.c_str () + name.length (), idx);
292303 if (result.ec != std::errc ()) {
293304 throw std::runtime_error (" invalid clip name: " + name);
294305 }
@@ -309,7 +320,7 @@ ExprOp decodeToken(const std::string &token, bool extended = false)
309320 size_t prefix = token[1 ] == ' u' ? 3 : 4 ;
310321 int idx = -1 ;
311322
312- auto result = std:: from_chars (token.c_str () + prefix, token.c_str () + token.length (), idx);
323+ auto result = from_chars (token.c_str () + prefix, token.c_str () + token.length (), idx);
313324 if (result.ec != std::errc ()) {
314325 // ...
315326 }
@@ -330,7 +341,7 @@ ExprOp decodeToken(const std::string &token, bool extended = false)
330341 size_t prefix = token[3 ] == ' s' ? 7 : 6 ;
331342 int idx = -1 ;
332343
333- auto result = std:: from_chars (token.c_str () + prefix, token.c_str () + token.length (), idx);
344+ auto result = from_chars (token.c_str () + prefix, token.c_str () + token.length (), idx);
334345 if (result.ec != std::errc ()) {
335346 // ...
336347 }
@@ -366,7 +377,7 @@ ExprOp decodeToken(const std::string &token, bool extended = false)
366377 float f = 0 ;
367378 const size_t len = token.size ();
368379
369- auto resultl = std:: from_chars (token.c_str (), token.c_str () + len, l, 0 );
380+ auto resultl = from_chars (token.c_str (), token.c_str () + len, l, 0 );
370381 if (resultl.ec == std::errc ()) {
371382 pos = std::distance (token.c_str (), resultl.ptr );
372383 }
@@ -377,7 +388,7 @@ ExprOp decodeToken(const std::string &token, bool extended = false)
377388 return { ExprOpType::CONSTANTF , (float )l };
378389 }
379390
380- auto resultf = std:: from_chars (token.c_str (), token.c_str () + len, f);
391+ auto resultf = from_chars (token.c_str (), token.c_str () + len, f);
381392 if (resultf.ec == std::errc ()) {
382393 pos = std::distance (token.c_str (), resultf.ptr );
383394 }
0 commit comments