1- /* auto-generated on 2025-03-27 15:01 :10 -0400. Do not edit! */
1+ /* auto-generated on 2025-06-04 00:22 :10 -0400. Do not edit! */
22/* including simdjson.cpp: */
33/* begin file simdjson.cpp */
44#define SIMDJSON_SRC_SIMDJSON_CPP
@@ -373,7 +373,7 @@ double from_chars(const char *first, const char* end) noexcept;
373373}
374374
375375#ifndef SIMDJSON_EXCEPTIONS
376- #if __cpp_exceptions
376+ #if defined( __cpp_exceptions) || defined(_CPPUNWIND)
377377#define SIMDJSON_EXCEPTIONS 1
378378#else
379379#define SIMDJSON_EXCEPTIONS 0
@@ -576,12 +576,14 @@ double from_chars(const char *first, const char* end) noexcept;
576576// even if we do not have C++17 support.
577577#ifdef __cpp_lib_string_view
578578#define SIMDJSON_HAS_STRING_VIEW
579+ #include <string_view>
579580#endif
580581
581582// Some systems have string_view even if we do not have C++17 support,
582583// and even if __cpp_lib_string_view is undefined, it is the case
583584// with Apple clang version 11.
584585// We must handle it. *This is important.*
586+ #ifndef _MSC_VER
585587#ifndef SIMDJSON_HAS_STRING_VIEW
586588#if defined __has_include
587589// do not combine the next #if with the previous one (unsafe)
@@ -597,6 +599,7 @@ double from_chars(const char *first, const char* end) noexcept;
597599#endif // __has_include (<string_view>)
598600#endif // defined __has_include
599601#endif // def SIMDJSON_HAS_STRING_VIEW
602+ #endif // def _MSC_VER
600603// end of complicated but important routine to try to detect string_view.
601604
602605//
@@ -2607,6 +2610,7 @@ struct simdjson_result_base : protected std::pair<T, error_code> {
26072610 * @throw simdjson_error if there was an error.
26082611 */
26092612 simdjson_inline operator T&&() && noexcept(false);
2613+
26102614#endif // SIMDJSON_EXCEPTIONS
26112615
26122616 /**
@@ -2663,7 +2667,17 @@ struct simdjson_result : public internal::simdjson_result_base<T> {
26632667 * @param value The variable to assign the value to. May not be set if there is an error.
26642668 */
26652669 simdjson_warn_unused simdjson_inline error_code get(T &value) && noexcept;
2666-
2670+ //
2671+ /**
2672+ * Copy the value to a provided std::string, only enabled for std::string_view.
2673+ *
2674+ * @param value The variable to assign the value to. May not be set if there is an error.
2675+ */
2676+ simdjson_warn_unused simdjson_inline error_code get(std::string &value) && noexcept
2677+ #if SIMDJSON_SUPPORTS_DESERIALIZATION
2678+ requires (!std::is_same_v<T, std::string>)
2679+ #endif // SIMDJSON_SUPPORTS_DESERIALIZATION
2680+ ;
26672681 /**
26682682 * The error.
26692683 */
@@ -4663,6 +4677,23 @@ simdjson_warn_unused simdjson_inline error_code simdjson_result<T>::get(T &value
46634677 return std::forward<internal::simdjson_result_base<T>>(*this).get(value);
46644678}
46654679
4680+ template<typename T>
4681+ simdjson_warn_unused simdjson_inline error_code
4682+ simdjson_result<T>::get(std::string &value) && noexcept
4683+ #if SIMDJSON_SUPPORTS_DESERIALIZATION
4684+ requires (!std::is_same_v<T, std::string>)
4685+ #endif // SIMDJSON_SUPPORTS_DESERIALIZATION
4686+ {
4687+ // SFINAE : n'active que pour T = std::string_view
4688+ static_assert(std::is_same<T, std::string_view>::value, "simdjson_result<T>::get(std::string&) n'est disponible que pour T = std::string_view");
4689+ std::string_view v;
4690+ error_code error = std::forward<simdjson_result<T>>(*this).get(v);
4691+ if (!error) {
4692+ value.assign(v.data(), v.size());
4693+ }
4694+ return error;
4695+ }
4696+
46664697template<typename T>
46674698simdjson_inline error_code simdjson_result<T>::error() const noexcept {
46684699 return internal::simdjson_result_base<T>::error();
@@ -9726,7 +9757,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
97269757 if (i > uint64_t(INT64_MAX)) {
97279758 WRITE_UNSIGNED(i, src, writer);
97289759 } else {
9729- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
9760+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
9761+ if(i == 0 && negative) {
9762+ // We have to write -0.0 instead of 0
9763+ WRITE_DOUBLE(-0.0, src, writer);
9764+ } else {
9765+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
9766+ }
9767+ #else
9768+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
9769+ #endif
97309770 }
97319771 if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
97329772 return SUCCESS;
@@ -10187,6 +10227,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
1018710227 if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
1018810228 return number_type::big_integer;
1018910229 }
10230+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
10231+ if(digit_count == 1 && src[0] == '0') {
10232+ // We have to write -0.0 instead of 0
10233+ return number_type::floating_point_number;
10234+ }
10235+ #endif
1019010236 return number_type::signed_integer;
1019110237 }
1019210238 // Let us check if we have a big integer (>=2**64).
@@ -16086,7 +16132,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
1608616132 if (i > uint64_t(INT64_MAX)) {
1608716133 WRITE_UNSIGNED(i, src, writer);
1608816134 } else {
16089- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
16135+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
16136+ if(i == 0 && negative) {
16137+ // We have to write -0.0 instead of 0
16138+ WRITE_DOUBLE(-0.0, src, writer);
16139+ } else {
16140+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
16141+ }
16142+ #else
16143+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
16144+ #endif
1609016145 }
1609116146 if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
1609216147 return SUCCESS;
@@ -16547,6 +16602,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
1654716602 if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
1654816603 return number_type::big_integer;
1654916604 }
16605+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
16606+ if(digit_count == 1 && src[0] == '0') {
16607+ // We have to write -0.0 instead of 0
16608+ return number_type::floating_point_number;
16609+ }
16610+ #endif
1655016611 return number_type::signed_integer;
1655116612 }
1655216613 // Let us check if we have a big integer (>=2**64).
@@ -22310,7 +22371,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
2231022371 if (i > uint64_t(INT64_MAX)) {
2231122372 WRITE_UNSIGNED(i, src, writer);
2231222373 } else {
22313- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
22374+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
22375+ if(i == 0 && negative) {
22376+ // We have to write -0.0 instead of 0
22377+ WRITE_DOUBLE(-0.0, src, writer);
22378+ } else {
22379+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
22380+ }
22381+ #else
22382+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
22383+ #endif
2231422384 }
2231522385 if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
2231622386 return SUCCESS;
@@ -22771,6 +22841,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
2277122841 if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
2277222842 return number_type::big_integer;
2277322843 }
22844+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
22845+ if(digit_count == 1 && src[0] == '0') {
22846+ // We have to write -0.0 instead of 0
22847+ return number_type::floating_point_number;
22848+ }
22849+ #endif
2277422850 return number_type::signed_integer;
2277522851 }
2277622852 // Let us check if we have a big integer (>=2**64).
@@ -28690,7 +28766,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
2869028766 if (i > uint64_t(INT64_MAX)) {
2869128767 WRITE_UNSIGNED(i, src, writer);
2869228768 } else {
28693- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
28769+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
28770+ if(i == 0 && negative) {
28771+ // We have to write -0.0 instead of 0
28772+ WRITE_DOUBLE(-0.0, src, writer);
28773+ } else {
28774+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
28775+ }
28776+ #else
28777+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
28778+ #endif
2869428779 }
2869528780 if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
2869628781 return SUCCESS;
@@ -29151,6 +29236,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
2915129236 if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
2915229237 return number_type::big_integer;
2915329238 }
29239+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
29240+ if(digit_count == 1 && src[0] == '0') {
29241+ // We have to write -0.0 instead of 0
29242+ return number_type::floating_point_number;
29243+ }
29244+ #endif
2915429245 return number_type::signed_integer;
2915529246 }
2915629247 // Let us check if we have a big integer (>=2**64).
@@ -35432,7 +35523,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
3543235523 if (i > uint64_t(INT64_MAX)) {
3543335524 WRITE_UNSIGNED(i, src, writer);
3543435525 } else {
35435- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
35526+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
35527+ if(i == 0 && negative) {
35528+ // We have to write -0.0 instead of 0
35529+ WRITE_DOUBLE(-0.0, src, writer);
35530+ } else {
35531+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
35532+ }
35533+ #else
35534+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
35535+ #endif
3543635536 }
3543735537 if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
3543835538 return SUCCESS;
@@ -35893,6 +35993,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
3589335993 if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
3589435994 return number_type::big_integer;
3589535995 }
35996+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
35997+ if(digit_count == 1 && src[0] == '0') {
35998+ // We have to write -0.0 instead of 0
35999+ return number_type::floating_point_number;
36000+ }
36001+ #endif
3589636002 return number_type::signed_integer;
3589736003 }
3589836004 // Let us check if we have a big integer (>=2**64).
@@ -41998,7 +42104,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
4199842104 if (i > uint64_t(INT64_MAX)) {
4199942105 WRITE_UNSIGNED(i, src, writer);
4200042106 } else {
42001- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
42107+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
42108+ if(i == 0 && negative) {
42109+ // We have to write -0.0 instead of 0
42110+ WRITE_DOUBLE(-0.0, src, writer);
42111+ } else {
42112+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
42113+ }
42114+ #else
42115+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
42116+ #endif
4200242117 }
4200342118 if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
4200442119 return SUCCESS;
@@ -42459,6 +42574,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
4245942574 if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
4246042575 return number_type::big_integer;
4246142576 }
42577+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
42578+ if(digit_count == 1 && src[0] == '0') {
42579+ // We have to write -0.0 instead of 0
42580+ return number_type::floating_point_number;
42581+ }
42582+ #endif
4246242583 return number_type::signed_integer;
4246342584 }
4246442585 // Let us check if we have a big integer (>=2**64).
@@ -48009,7 +48130,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
4800948130 if (i > uint64_t(INT64_MAX)) {
4801048131 WRITE_UNSIGNED(i, src, writer);
4801148132 } else {
48012- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
48133+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
48134+ if(i == 0 && negative) {
48135+ // We have to write -0.0 instead of 0
48136+ WRITE_DOUBLE(-0.0, src, writer);
48137+ } else {
48138+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
48139+ }
48140+ #else
48141+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
48142+ #endif
4801348143 }
4801448144 if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
4801548145 return SUCCESS;
@@ -48470,6 +48600,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
4847048600 if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
4847148601 return number_type::big_integer;
4847248602 }
48603+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
48604+ if(digit_count == 1 && src[0] == '0') {
48605+ // We have to write -0.0 instead of 0
48606+ return number_type::floating_point_number;
48607+ }
48608+ #endif
4847348609 return number_type::signed_integer;
4847448610 }
4847548611 // Let us check if we have a big integer (>=2**64).
@@ -53619,7 +53755,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
5361953755 if (i > uint64_t(INT64_MAX)) {
5362053756 WRITE_UNSIGNED(i, src, writer);
5362153757 } else {
53622- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
53758+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
53759+ if(i == 0 && negative) {
53760+ // We have to write -0.0 instead of 0
53761+ WRITE_DOUBLE(-0.0, src, writer);
53762+ } else {
53763+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
53764+ }
53765+ #else
53766+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
53767+ #endif
5362353768 }
5362453769 if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
5362553770 return SUCCESS;
@@ -54080,6 +54225,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
5408054225 if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
5408154226 return number_type::big_integer;
5408254227 }
54228+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
54229+ if(digit_count == 1 && src[0] == '0') {
54230+ // We have to write -0.0 instead of 0
54231+ return number_type::floating_point_number;
54232+ }
54233+ #endif
5408354234 return number_type::signed_integer;
5408454235 }
5408554236 // Let us check if we have a big integer (>=2**64).
0 commit comments