Reverting.

This commit is contained in:
Daniel Lemire 2020-06-17 17:52:07 +00:00
parent 4474f8ef18
commit 0655a135e6
1 changed files with 14 additions and 0 deletions

View File

@ -199,6 +199,7 @@ bool ParseDouble(const char *j, double &d) {
}
// See https://github.com/miloyip/nativejson-benchmark/blob/master/src/tests/simdjsontest.cpp
#ifdef SIMDJSON_CPLUSPLUS17
bool ParseString(const char *j, std::string &s) {
auto [answer, error] = parser.parse(j,strlen(j))
.at(0)
@ -207,6 +208,19 @@ bool ParseString(const char *j, std::string &s) {
s.assign(answer.data(), answer.size());
return true;
}
#else
bool ParseString(const char *j, std::string &s) {
simdjson::error_code error;
std::string_view answer;
parser.parse(j,strlen(j))
.at(0)
.get<std::string_view>()
.tie(answer, error);
if (error) { return false; }
s.assign(answer.data(), answer.size());
return true;
}
#endif
int main() {