Skip to content

Commit

Permalink
fix(tools): fix build on macos
Browse files Browse the repository at this point in the history
shipped version of clang doesn't have from_chars implemented yet
  • Loading branch information
oyvindln committed Feb 9, 2024
1 parent c85594a commit 75e9ac2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/library/tbc/jsonio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "jsonio.h"

#include <limits>
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || (__cplusplus >= 201703L && !defined(__clang__)))
#include <charconv>
#else
#include <sstream>
Expand Down Expand Up @@ -337,8 +337,9 @@ void JsonReader::readNumber(double &value)
}
}

#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
// Use the faster C++17 method if available.
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || (__cplusplus >= 201703L && !defined(__clang__)))
// Use the faster C++17 method if available.
// (Skip if clang is detected since it was late to implement, and thus not available on macos yet.)
std::from_chars(buf.data(), buf.data() + buf.size(), value);
#else
std::istringstream(buf) >> value;
Expand Down

0 comments on commit 75e9ac2

Please sign in to comment.