Skip to content

Commit 0655a13

Browse files
author
Daniel Lemire
committed
Reverting.
1 parent 4474f8e commit 0655a13

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/readme_examples_noexceptions.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ bool ParseDouble(const char *j, double &d) {
199199
}
200200

201201
// See https://github.com/miloyip/nativejson-benchmark/blob/master/src/tests/simdjsontest.cpp
202+
#ifdef SIMDJSON_CPLUSPLUS17
202203
bool ParseString(const char *j, std::string &s) {
203204
auto [answer, error] = parser.parse(j,strlen(j))
204205
.at(0)
@@ -207,6 +208,19 @@ bool ParseString(const char *j, std::string &s) {
207208
s.assign(answer.data(), answer.size());
208209
return true;
209210
}
211+
#else
212+
bool ParseString(const char *j, std::string &s) {
213+
simdjson::error_code error;
214+
std::string_view answer;
215+
parser.parse(j,strlen(j))
216+
.at(0)
217+
.get<std::string_view>()
218+
.tie(answer, error);
219+
if (error) { return false; }
220+
s.assign(answer.data(), answer.size());
221+
return true;
222+
}
223+
#endif
210224

211225

212226
int main() {

0 commit comments

Comments
 (0)