Reverting.
This commit is contained in:
parent
4474f8ef18
commit
0655a135e6
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue