From 73e69a5e8463acadda6b9618ba236b25d9dd9b30 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Apr 2026 15:32:42 -0400 Subject: [PATCH] Get reflection working without warnings under GCC 16 (#2658) * wip gcc16 * progress * minor gcc16 fixes * final step * Update include/simdjson/padded_string-inl.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update include/simdjson/padded_string.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * renaming test function --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- CMakeLists.txt | 24 + doc/basics.md | 4 - include/simdjson/compile_time_json-inl.h | 69 +- include/simdjson/constevalutil.h | 5 + .../simdjson/generic/builder/json_builder.h | 21 +- .../generic/builder/json_string_builder-inl.h | 4 +- .../generic/builder/json_string_builder.h | 4 +- .../simdjson/generic/ondemand/document-inl.h | 24 +- include/simdjson/generic/ondemand/document.h | 48 +- .../generic/ondemand/std_deserialize.h | 2 +- jsonexamples/example_config.json | 11 + singleheader/simdjson.cpp | 7 +- singleheader/simdjson.h | 1003 ++++++++--------- singleheader/singleheader.zip | Bin 10446628 -> 10449986 bytes .../static_reflection_builder_tests.cpp | 38 +- .../static_reflection_comprehensive_tests.cpp | 132 ++- .../static_reflection_custom_tests.cpp | 8 +- .../static_reflection_edge_cases_tests.cpp | 40 +- .../builder/static_reflection_enum_tests.cpp | 14 +- ...static_reflection_fractured_json_tests.cpp | 22 +- .../compile_time/compile_time_json_tests.cpp | 21 +- tests/ondemand/ondemand_convert_tests.cpp | 24 +- .../ondemand_wrong_type_error_tests.cpp | 4 +- 23 files changed, 750 insertions(+), 779 deletions(-) create mode 100644 jsonexamples/example_config.json diff --git a/CMakeLists.txt b/CMakeLists.txt index c3a1d473b..1363cdf03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,13 +167,37 @@ if(MSVC) endif() endif() + + if(SIMDJSON_STATIC_REFLECTION) + + + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION MATCHES "^21") + execute_process( + COMMAND ${CMAKE_CXX_COMPILER} --version + OUTPUT_VARIABLE CLANG_VERSION_OUTPUT + ERROR_VARIABLE CLANG_VERSION_ERROR + RESULT_VARIABLE CLANG_VERSION_RESULT + ) + if(CLANG_VERSION_RESULT EQUAL 0 AND CLANG_VERSION_OUTPUT MATCHES "https://github.com/bloomberg/clang-p2996.git") + set(IS_BLOOMBERG_P2996_CLANG ON) + message(STATUS "Using Bloomberg P2996 Clang fork") + endif() + endif() + # We would like to require C++26, but no compiler supports that! # This is a hack: + if(IS_BLOOMBERG_P2996_CLANG) simdjson_add_props( target_compile_options PUBLIC -freflection -fexpansion-statements -stdlib=libc++ -std=c++26 ) + else() + simdjson_add_props( + target_compile_options PUBLIC + -freflection -std=c++26 + ) + endif() else() simdjson_add_props(target_compile_features PUBLIC cxx_std_11) endif() diff --git a/doc/basics.md b/doc/basics.md index 7eb258fe8..fd5e36170 100644 --- a/doc/basics.md +++ b/doc/basics.md @@ -1300,10 +1300,6 @@ You can also use the custom `Car` type as part of a template such as `std::vecto simdjson::ondemand::parser parser; simdjson::ondemand::document doc = parser.iterate(json); std::vector cars(doc); - // visual studio users need an explicit call: - // std::vector cars = doc.get>(); - // because the compiler does not know whether to convert - // doc to an unsigned int or to a vector. for(Car& c : cars) { std::cout << c.year << std::endl; } diff --git a/include/simdjson/compile_time_json-inl.h b/include/simdjson/compile_time_json-inl.h index c4cae09a5..d85b150ef 100644 --- a/include/simdjson/compile_time_json-inl.h +++ b/include/simdjson/compile_time_json-inl.h @@ -266,6 +266,12 @@ consteval std::pair parse_double(const char *src, } } // namespace number_parsing +consteval auto make_data_member_options(auto&& name_str) { + std::meta::data_member_options options{}; + options.name = std::forward(name_str); + return options; +} + // JSON string may contain embedded nulls, and C++26 reflection does not yet // support std::string_view as a data member type. As a workaround, we define // a custom type that holds a const char* and a size. @@ -320,7 +326,8 @@ using class_type = type_builder::constructed_type; /** * @brief Variable template for constructing instances with values */ -template constexpr auto construct_from = T{Vs...}; +template constexpr T construct_from = T{Vs...}; + // in JSON, there are only a few whitespace characters that are allowed // outside of objects, arrays, strings, and numbers. @@ -410,7 +417,7 @@ parse_number(std::string_view json, std::from_chars(json.data(), json.data() + json.size(), int_value); if (res.ec == std::errc()) { out = int_value; - if ((res.ptr - json.data()) != scope) { + if (static_cast(res.ptr - json.data()) != scope) { simdjson_consteval_error( "Internal error: cannot agree on the character range of the float"); } @@ -424,7 +431,7 @@ parse_number(std::string_view json, std::from_chars(json.data(), json.data() + json.size(), uint_value); if (res.ec == std::errc()) { out = uint_value; - if ((res.ptr - json.data()) != scope) { + if (static_cast(res.ptr - json.data()) != scope) { simdjson_consteval_error( "Internal error: cannot agree on the character range of the float"); } @@ -533,7 +540,7 @@ parse_string(std::string_view json) { // present, we have an error (isolated high surrogate), which we // tolerate by substituting the substitution_code_point. if (end - cursor < 6 || *cursor != '\\' || - *(cursor + 1) != 'u' > 0xFFFF) { + *(cursor + 1) != 'u') { code_point = substitution_code_point; } else { // we have \u following the high surrogate cursor += 2; // skip \u @@ -887,10 +894,19 @@ parse_json_array_impl(const std::string_view json) { std::size_t count = values.size() - 1; // We assume all elements have the same type as the first element. // However, if the array is heterogeneous, we should use std::variant. + auto elem_type = std::meta::type_of(values[1]); + // String literals reflected via reflect_constant_string have type const + // char[N], but when passed as template auto parameters they decay to + // const char*. Use const char* as the element type so that + // construct_from can aggregate-initialize the array. + if (std::meta::is_array_type(elem_type) && + std::meta::remove_all_extents(elem_type) == ^^const char) { + elem_type = ^^const char *; + } auto array_type = std::meta::substitute( ^^std::array, { - std::meta::type_of(values[1]), std::meta::reflect_constant(count)}); + elem_type, std::meta::reflect_constant(count)}); // Create array instance with values values[0] = array_type; @@ -957,8 +973,7 @@ parse_json_object_impl(std::string_view json) { simdjson_consteval_error("Expected '}'"); } cursor += object_size; - auto dms = std::meta::data_member_spec(std::meta::type_of(parsed), - {.name = field_name}); + auto dms = std::meta::data_member_spec(std::meta::type_of(parsed), make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(parsed); @@ -967,8 +982,7 @@ parse_json_object_impl(std::string_view json) { case '[': { std::string_view value(cursor, end); auto [parsed, array_size] = parse_json_array_impl(value); - auto dms = std::meta::data_member_spec(std::meta::type_of(parsed), - {.name = field_name}); + auto dms = std::meta::data_member_spec(std::meta::type_of(parsed), make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(parsed); if (*(cursor + array_size - 1) != ']') { @@ -989,8 +1003,7 @@ parse_json_object_impl(std::string_view json) { } } auto dms = - std::meta::data_member_spec(^^const char *, { - .name = field_name}); + std::meta::data_member_spec(^^const char *, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant_string(value)); break; @@ -1001,8 +1014,7 @@ parse_json_object_impl(std::string_view json) { } cursor += 4; - auto dms = std::meta::data_member_spec(^^bool, { - .name = field_name}); + auto dms = std::meta::data_member_spec(^^bool, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant(true)); break; @@ -1013,8 +1025,7 @@ parse_json_object_impl(std::string_view json) { } cursor += 5; - auto dms = std::meta::data_member_spec(^^bool, { - .name = field_name}); + auto dms = std::meta::data_member_spec(^^bool, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant(false)); break; @@ -1025,9 +1036,7 @@ parse_json_object_impl(std::string_view json) { } cursor += 4; - auto dms = std::meta::data_member_spec(^^std::nullptr_t, - { - .name = field_name}); + auto dms = std::meta::data_member_spec(^^std::nullptr_t, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant(nullptr)); break; @@ -1051,22 +1060,19 @@ parse_json_object_impl(std::string_view json) { if (std::holds_alternative(out)) { int64_t int_value = std::get(out); auto dms = - std::meta::data_member_spec(^^int64_t, { - .name = field_name}); + std::meta::data_member_spec(^^int64_t, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant(int_value)); } else if (std::holds_alternative(out)) { uint64_t uint_value = std::get(out); auto dms = - std::meta::data_member_spec(^^uint64_t, { - .name = field_name}); + std::meta::data_member_spec(^^uint64_t, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant(uint_value)); } else { double float_value = std::get(out); auto dms = - std::meta::data_member_spec(^^double, { - .name = field_name}); + std::meta::data_member_spec(^^double, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant(float_value)); } @@ -1111,16 +1117,11 @@ template consteval auto parse_json() { "Only JSON objects and arrays are supported at the top level, this " "limitation will be lifted in the future.");*/ - constexpr auto result = json.front() == '[' - ? parse_json_array_impl(json) - : parse_json_object_impl(json); - return [: result.first :]; - /* - if(json.front() == '[') { - return [:parse_json_array_impl(json).first:]; - } else if(json.front() == '{') { - // return [:parse_json_object_impl(json).first:]; - }*/ + if constexpr (json.front() == '[') { + return [: parse_json_array_impl(json).first :]; + } else { + return [: parse_json_object_impl(json).first :]; + } } } // namespace compile_time diff --git a/include/simdjson/constevalutil.h b/include/simdjson/constevalutil.h index 7fb5f59f4..d33f5aa0c 100644 --- a/include/simdjson/constevalutil.h +++ b/include/simdjson/constevalutil.h @@ -58,6 +58,11 @@ struct fixed_string { data[i] = str[i]; } } + constexpr fixed_string(const unsigned char (&str)[N]) { + for (std::size_t i = 0; i < N; ++i) { + data[i] = static_cast(str[i]); + } + } char data[N]; constexpr std::string_view view() const { return {data, N - 1}; } constexpr size_t size() const { return N ; } diff --git a/include/simdjson/generic/builder/json_builder.h b/include/simdjson/generic/builder/json_builder.h index 0ea58e223..7e022d739 100644 --- a/include/simdjson/generic/builder/json_builder.h +++ b/include/simdjson/generic/builder/json_builder.h @@ -22,7 +22,7 @@ namespace SIMDJSON_IMPLEMENTATION { namespace builder { template - requires(concepts::container_but_not_string && !require_custom_serialization) + requires(concepts::container_but_not_string && ! concepts::optional_type && !require_custom_serialization) constexpr void atom(string_builder &b, const T &t) { auto it = t.begin(); auto end = t.end(); @@ -130,7 +130,7 @@ template requires(std::is_enum_v && !require_custom_serialization) void atom(string_builder &b, const T &e) { #if SIMDJSON_STATIC_REFLECTION - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { constexpr auto enum_str = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(enum_val))); if (e == [:enum_val:]) { @@ -294,30 +294,23 @@ string_builder& operator<<(string_builder& b, const Z& z) { template requires(std::is_class_v && (sizeof...(FieldNames) > 0)) void extract_from(string_builder &b, const T &obj) { - // Helper to check if a field name matches any of the requested fields - auto should_extract = [](std::string_view field_name) constexpr -> bool { - return ((FieldNames.view() == field_name) || ...); - }; - b.append('{'); bool first = true; - // Iterate through all members of T using reflection - template for (constexpr auto mem : std::define_static_array( - std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked()))) { - + static constexpr auto members = std::define_static_array(std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked())); + template for (constexpr auto mem : members) { if constexpr (std::meta::is_public(mem)) { - constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); + static constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); // Only serialize this field if it's in our list of requested fields - if constexpr (should_extract(key)) { + if constexpr (((FieldNames.view() == key) || ...)) { if (!first) { b.append(','); } first = false; // Serialize the key - constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); + static constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); b.append_raw(quoted_key); b.append(':'); diff --git a/include/simdjson/generic/builder/json_string_builder-inl.h b/include/simdjson/generic/builder/json_string_builder-inl.h index 0f7707851..d6c368b33 100644 --- a/include/simdjson/generic/builder/json_string_builder-inl.h +++ b/include/simdjson/generic/builder/json_string_builder-inl.h @@ -505,7 +505,7 @@ simdjson_inline bool string_builder::capacity_check(size_t upcoming_bytes) { return is_valid; } -simdjson_inline void string_builder::grow_buffer(size_t desired_capacity) { +inline void string_builder::grow_buffer(size_t desired_capacity) { if (!is_valid) { return; } @@ -842,7 +842,7 @@ simdjson_inline void string_builder::append(const T &value) { #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template - requires(!std::is_convertible::value && !require_custom_serialization) + requires(!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void string_builder::append(const R &range) noexcept { auto it = std::ranges::begin(range); auto end = std::ranges::end(range); diff --git a/include/simdjson/generic/builder/json_string_builder.h b/include/simdjson/generic/builder/json_string_builder.h index 0ab4aa49b..39196d182 100644 --- a/include/simdjson/generic/builder/json_string_builder.h +++ b/include/simdjson/generic/builder/json_string_builder.h @@ -171,7 +171,7 @@ public: #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template -requires (!std::is_convertible::value && !require_custom_serialization) +requires (!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void append(const R &range) noexcept; #endif /** @@ -249,7 +249,7 @@ private: * If the allocation fails, is_valid is set to false. We expect * that this function would not be repeatedly called. */ - simdjson_inline void grow_buffer(size_t desired_capacity); + inline void grow_buffer(size_t desired_capacity); /** * We use this helper function to make sure that is_valid is kept consistent. diff --git a/include/simdjson/generic/ondemand/document-inl.h b/include/simdjson/generic/ondemand/document-inl.h index b98de19b1..f4627564a 100644 --- a/include/simdjson/generic/ondemand/document-inl.h +++ b/include/simdjson/generic/ondemand/document-inl.h @@ -653,27 +653,27 @@ simdjson_inline simdjson_result::op } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator SIMDJSON_IMPLEMENTATION::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator SIMDJSON_IMPLEMENTATION::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -1042,27 +1042,27 @@ simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator SIMDJSON_IMPLEMENTATION::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator SIMDJSON_IMPLEMENTATION::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } diff --git a/include/simdjson/generic/ondemand/document.h b/include/simdjson/generic/ondemand/document.h index 29dceb2b1..65f28d1c6 100644 --- a/include/simdjson/generic/ondemand/document.h +++ b/include/simdjson/generic/ondemand/document.h @@ -319,21 +319,21 @@ public: * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit unsigned integer. */ - simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); /** * Cast this JSON value to a signed integer. * * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit integer. */ - simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); /** * Cast this JSON value to a double. * * @returns A double. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a valid floating-point number. */ - simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); /** * Cast this JSON value to a string. * @@ -343,7 +343,7 @@ public: * time it parses a document or when it is destroyed. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a raw_json_string. * @@ -352,14 +352,14 @@ public: * @returns A pointer to the raw JSON for the given string. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a bool. * * @returns A bool value. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not true or false. */ - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); /** * Cast this JSON value to a value when the document is an object or an array. * @@ -945,12 +945,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator array() & noexcept(false); simdjson_inline operator object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -1030,12 +1030,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::array() & noexcept(false); simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -1116,12 +1116,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::array() & noexcept(false); simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator SIMDJSON_IMPLEMENTATION::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; diff --git a/include/simdjson/generic/ondemand/std_deserialize.h b/include/simdjson/generic/ondemand/std_deserialize.h index 2827be06d..36350ce85 100644 --- a/include/simdjson/generic/ondemand/std_deserialize.h +++ b/include/simdjson/generic/ondemand/std_deserialize.h @@ -305,7 +305,7 @@ error_code tag_invoke(deserialize_tag, ValT &val, T &out) noexcept { #if SIMDJSON_STATIC_REFLECTION std::string_view str; SIMDJSON_TRY(val.get_string().get(str)); - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { if (str == std::meta::identifier_of(enum_val)) { out = [:enum_val:]; diff --git a/jsonexamples/example_config.json b/jsonexamples/example_config.json new file mode 100644 index 000000000..589442d69 --- /dev/null +++ b/jsonexamples/example_config.json @@ -0,0 +1,11 @@ +{ + "app_name": "MyApp", + "version": "1.0.0", + "port": 8080, + "debug": true, + "features": ["logging", "caching"], + "database": { + "host": "localhost", + "port": 5432 + } +} \ No newline at end of file diff --git a/singleheader/simdjson.cpp b/singleheader/simdjson.cpp index cbcd9f1e6..fb4c6adbe 100644 --- a/singleheader/simdjson.cpp +++ b/singleheader/simdjson.cpp @@ -1,4 +1,4 @@ -/* auto-generated on 2026-04-03 15:25:03 -0400. version 4.6.1 Do not edit! */ +/* auto-generated on 2026-04-02 19:14:16 -0400. version 4.6.1 Do not edit! */ /* including simdjson.cpp: */ /* begin file simdjson.cpp */ #define SIMDJSON_SRC_SIMDJSON_CPP @@ -3168,6 +3168,11 @@ struct fixed_string { data[i] = str[i]; } } + constexpr fixed_string(const unsigned char (&str)[N]) { + for (std::size_t i = 0; i < N; ++i) { + data[i] = static_cast(str[i]); + } + } char data[N]; constexpr std::string_view view() const { return {data, N - 1}; } constexpr size_t size() const { return N ; } diff --git a/singleheader/simdjson.h b/singleheader/simdjson.h index 0a0215313..7a5d7f17f 100644 --- a/singleheader/simdjson.h +++ b/singleheader/simdjson.h @@ -1,4 +1,4 @@ -/* auto-generated on 2026-04-03 15:25:03 -0400. version 4.6.1 Do not edit! */ +/* auto-generated on 2026-04-02 19:14:16 -0400. version 4.6.1 Do not edit! */ /* including simdjson.h: */ /* begin file simdjson.h */ #ifndef SIMDJSON_H @@ -3231,6 +3231,11 @@ struct fixed_string { data[i] = str[i]; } } + constexpr fixed_string(const unsigned char (&str)[N]) { + for (std::size_t i = 0; i < N; ++i) { + data[i] = static_cast(str[i]); + } + } char data[N]; constexpr std::string_view view() const { return {data, N - 1}; } constexpr size_t size() const { return N ; } @@ -39158,7 +39163,7 @@ public: #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template -requires (!std::is_convertible::value && !require_custom_serialization) +requires (!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void append(const R &range) noexcept; #endif /** @@ -39236,7 +39241,7 @@ private: * If the allocation fails, is_valid is set to false. We expect * that this function would not be repeatedly called. */ - simdjson_inline void grow_buffer(size_t desired_capacity); + inline void grow_buffer(size_t desired_capacity); /** * We use this helper function to make sure that is_valid is kept consistent. @@ -39311,7 +39316,7 @@ namespace arm64 { namespace builder { template - requires(concepts::container_but_not_string && !require_custom_serialization) + requires(concepts::container_but_not_string && ! concepts::optional_type && !require_custom_serialization) constexpr void atom(string_builder &b, const T &t) { auto it = t.begin(); auto end = t.end(); @@ -39419,7 +39424,7 @@ template requires(std::is_enum_v && !require_custom_serialization) void atom(string_builder &b, const T &e) { #if SIMDJSON_STATIC_REFLECTION - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { constexpr auto enum_str = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(enum_val))); if (e == [:enum_val:]) { @@ -39583,30 +39588,23 @@ string_builder& operator<<(string_builder& b, const Z& z) { template requires(std::is_class_v && (sizeof...(FieldNames) > 0)) void extract_from(string_builder &b, const T &obj) { - // Helper to check if a field name matches any of the requested fields - auto should_extract = [](std::string_view field_name) constexpr -> bool { - return ((FieldNames.view() == field_name) || ...); - }; - b.append('{'); bool first = true; - // Iterate through all members of T using reflection - template for (constexpr auto mem : std::define_static_array( - std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked()))) { - + static constexpr auto members = std::define_static_array(std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked())); + template for (constexpr auto mem : members) { if constexpr (std::meta::is_public(mem)) { - constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); + static constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); // Only serialize this field if it's in our list of requested fields - if constexpr (should_extract(key)) { + if constexpr (((FieldNames.view() == key) || ...)) { if (!first) { b.append(','); } first = false; // Serialize the key - constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); + static constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); b.append_raw(quoted_key); b.append(':'); @@ -40299,7 +40297,7 @@ simdjson_inline bool string_builder::capacity_check(size_t upcoming_bytes) { return is_valid; } -simdjson_inline void string_builder::grow_buffer(size_t desired_capacity) { +inline void string_builder::grow_buffer(size_t desired_capacity) { if (!is_valid) { return; } @@ -40636,7 +40634,7 @@ simdjson_inline void string_builder::append(const T &value) { #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template - requires(!std::is_convertible::value && !require_custom_serialization) + requires(!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void string_builder::append(const R &range) noexcept { auto it = std::ranges::begin(range); auto end = std::ranges::end(range); @@ -41242,7 +41240,7 @@ public: #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template -requires (!std::is_convertible::value && !require_custom_serialization) +requires (!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void append(const R &range) noexcept; #endif /** @@ -41320,7 +41318,7 @@ private: * If the allocation fails, is_valid is set to false. We expect * that this function would not be repeatedly called. */ - simdjson_inline void grow_buffer(size_t desired_capacity); + inline void grow_buffer(size_t desired_capacity); /** * We use this helper function to make sure that is_valid is kept consistent. @@ -41395,7 +41393,7 @@ namespace fallback { namespace builder { template - requires(concepts::container_but_not_string && !require_custom_serialization) + requires(concepts::container_but_not_string && ! concepts::optional_type && !require_custom_serialization) constexpr void atom(string_builder &b, const T &t) { auto it = t.begin(); auto end = t.end(); @@ -41503,7 +41501,7 @@ template requires(std::is_enum_v && !require_custom_serialization) void atom(string_builder &b, const T &e) { #if SIMDJSON_STATIC_REFLECTION - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { constexpr auto enum_str = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(enum_val))); if (e == [:enum_val:]) { @@ -41667,30 +41665,23 @@ string_builder& operator<<(string_builder& b, const Z& z) { template requires(std::is_class_v && (sizeof...(FieldNames) > 0)) void extract_from(string_builder &b, const T &obj) { - // Helper to check if a field name matches any of the requested fields - auto should_extract = [](std::string_view field_name) constexpr -> bool { - return ((FieldNames.view() == field_name) || ...); - }; - b.append('{'); bool first = true; - // Iterate through all members of T using reflection - template for (constexpr auto mem : std::define_static_array( - std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked()))) { - + static constexpr auto members = std::define_static_array(std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked())); + template for (constexpr auto mem : members) { if constexpr (std::meta::is_public(mem)) { - constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); + static constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); // Only serialize this field if it's in our list of requested fields - if constexpr (should_extract(key)) { + if constexpr (((FieldNames.view() == key) || ...)) { if (!first) { b.append(','); } first = false; // Serialize the key - constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); + static constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); b.append_raw(quoted_key); b.append(':'); @@ -42383,7 +42374,7 @@ simdjson_inline bool string_builder::capacity_check(size_t upcoming_bytes) { return is_valid; } -simdjson_inline void string_builder::grow_buffer(size_t desired_capacity) { +inline void string_builder::grow_buffer(size_t desired_capacity) { if (!is_valid) { return; } @@ -42720,7 +42711,7 @@ simdjson_inline void string_builder::append(const T &value) { #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template - requires(!std::is_convertible::value && !require_custom_serialization) + requires(!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void string_builder::append(const R &range) noexcept { auto it = std::ranges::begin(range); auto end = std::ranges::end(range); @@ -43813,7 +43804,7 @@ public: #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template -requires (!std::is_convertible::value && !require_custom_serialization) +requires (!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void append(const R &range) noexcept; #endif /** @@ -43891,7 +43882,7 @@ private: * If the allocation fails, is_valid is set to false. We expect * that this function would not be repeatedly called. */ - simdjson_inline void grow_buffer(size_t desired_capacity); + inline void grow_buffer(size_t desired_capacity); /** * We use this helper function to make sure that is_valid is kept consistent. @@ -43966,7 +43957,7 @@ namespace haswell { namespace builder { template - requires(concepts::container_but_not_string && !require_custom_serialization) + requires(concepts::container_but_not_string && ! concepts::optional_type && !require_custom_serialization) constexpr void atom(string_builder &b, const T &t) { auto it = t.begin(); auto end = t.end(); @@ -44074,7 +44065,7 @@ template requires(std::is_enum_v && !require_custom_serialization) void atom(string_builder &b, const T &e) { #if SIMDJSON_STATIC_REFLECTION - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { constexpr auto enum_str = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(enum_val))); if (e == [:enum_val:]) { @@ -44238,30 +44229,23 @@ string_builder& operator<<(string_builder& b, const Z& z) { template requires(std::is_class_v && (sizeof...(FieldNames) > 0)) void extract_from(string_builder &b, const T &obj) { - // Helper to check if a field name matches any of the requested fields - auto should_extract = [](std::string_view field_name) constexpr -> bool { - return ((FieldNames.view() == field_name) || ...); - }; - b.append('{'); bool first = true; - // Iterate through all members of T using reflection - template for (constexpr auto mem : std::define_static_array( - std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked()))) { - + static constexpr auto members = std::define_static_array(std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked())); + template for (constexpr auto mem : members) { if constexpr (std::meta::is_public(mem)) { - constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); + static constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); // Only serialize this field if it's in our list of requested fields - if constexpr (should_extract(key)) { + if constexpr (((FieldNames.view() == key) || ...)) { if (!first) { b.append(','); } first = false; // Serialize the key - constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); + static constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); b.append_raw(quoted_key); b.append(':'); @@ -44954,7 +44938,7 @@ simdjson_inline bool string_builder::capacity_check(size_t upcoming_bytes) { return is_valid; } -simdjson_inline void string_builder::grow_buffer(size_t desired_capacity) { +inline void string_builder::grow_buffer(size_t desired_capacity) { if (!is_valid) { return; } @@ -45291,7 +45275,7 @@ simdjson_inline void string_builder::append(const T &value) { #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template - requires(!std::is_convertible::value && !require_custom_serialization) + requires(!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void string_builder::append(const R &range) noexcept { auto it = std::ranges::begin(range); auto end = std::ranges::end(range); @@ -46384,7 +46368,7 @@ public: #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template -requires (!std::is_convertible::value && !require_custom_serialization) +requires (!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void append(const R &range) noexcept; #endif /** @@ -46462,7 +46446,7 @@ private: * If the allocation fails, is_valid is set to false. We expect * that this function would not be repeatedly called. */ - simdjson_inline void grow_buffer(size_t desired_capacity); + inline void grow_buffer(size_t desired_capacity); /** * We use this helper function to make sure that is_valid is kept consistent. @@ -46537,7 +46521,7 @@ namespace icelake { namespace builder { template - requires(concepts::container_but_not_string && !require_custom_serialization) + requires(concepts::container_but_not_string && ! concepts::optional_type && !require_custom_serialization) constexpr void atom(string_builder &b, const T &t) { auto it = t.begin(); auto end = t.end(); @@ -46645,7 +46629,7 @@ template requires(std::is_enum_v && !require_custom_serialization) void atom(string_builder &b, const T &e) { #if SIMDJSON_STATIC_REFLECTION - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { constexpr auto enum_str = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(enum_val))); if (e == [:enum_val:]) { @@ -46809,30 +46793,23 @@ string_builder& operator<<(string_builder& b, const Z& z) { template requires(std::is_class_v && (sizeof...(FieldNames) > 0)) void extract_from(string_builder &b, const T &obj) { - // Helper to check if a field name matches any of the requested fields - auto should_extract = [](std::string_view field_name) constexpr -> bool { - return ((FieldNames.view() == field_name) || ...); - }; - b.append('{'); bool first = true; - // Iterate through all members of T using reflection - template for (constexpr auto mem : std::define_static_array( - std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked()))) { - + static constexpr auto members = std::define_static_array(std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked())); + template for (constexpr auto mem : members) { if constexpr (std::meta::is_public(mem)) { - constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); + static constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); // Only serialize this field if it's in our list of requested fields - if constexpr (should_extract(key)) { + if constexpr (((FieldNames.view() == key) || ...)) { if (!first) { b.append(','); } first = false; // Serialize the key - constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); + static constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); b.append_raw(quoted_key); b.append(':'); @@ -47525,7 +47502,7 @@ simdjson_inline bool string_builder::capacity_check(size_t upcoming_bytes) { return is_valid; } -simdjson_inline void string_builder::grow_buffer(size_t desired_capacity) { +inline void string_builder::grow_buffer(size_t desired_capacity) { if (!is_valid) { return; } @@ -47862,7 +47839,7 @@ simdjson_inline void string_builder::append(const T &value) { #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template - requires(!std::is_convertible::value && !require_custom_serialization) + requires(!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void string_builder::append(const R &range) noexcept { auto it = std::ranges::begin(range); auto end = std::ranges::end(range); @@ -49070,7 +49047,7 @@ public: #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template -requires (!std::is_convertible::value && !require_custom_serialization) +requires (!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void append(const R &range) noexcept; #endif /** @@ -49148,7 +49125,7 @@ private: * If the allocation fails, is_valid is set to false. We expect * that this function would not be repeatedly called. */ - simdjson_inline void grow_buffer(size_t desired_capacity); + inline void grow_buffer(size_t desired_capacity); /** * We use this helper function to make sure that is_valid is kept consistent. @@ -49223,7 +49200,7 @@ namespace ppc64 { namespace builder { template - requires(concepts::container_but_not_string && !require_custom_serialization) + requires(concepts::container_but_not_string && ! concepts::optional_type && !require_custom_serialization) constexpr void atom(string_builder &b, const T &t) { auto it = t.begin(); auto end = t.end(); @@ -49331,7 +49308,7 @@ template requires(std::is_enum_v && !require_custom_serialization) void atom(string_builder &b, const T &e) { #if SIMDJSON_STATIC_REFLECTION - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { constexpr auto enum_str = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(enum_val))); if (e == [:enum_val:]) { @@ -49495,30 +49472,23 @@ string_builder& operator<<(string_builder& b, const Z& z) { template requires(std::is_class_v && (sizeof...(FieldNames) > 0)) void extract_from(string_builder &b, const T &obj) { - // Helper to check if a field name matches any of the requested fields - auto should_extract = [](std::string_view field_name) constexpr -> bool { - return ((FieldNames.view() == field_name) || ...); - }; - b.append('{'); bool first = true; - // Iterate through all members of T using reflection - template for (constexpr auto mem : std::define_static_array( - std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked()))) { - + static constexpr auto members = std::define_static_array(std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked())); + template for (constexpr auto mem : members) { if constexpr (std::meta::is_public(mem)) { - constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); + static constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); // Only serialize this field if it's in our list of requested fields - if constexpr (should_extract(key)) { + if constexpr (((FieldNames.view() == key) || ...)) { if (!first) { b.append(','); } first = false; // Serialize the key - constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); + static constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); b.append_raw(quoted_key); b.append(':'); @@ -50211,7 +50181,7 @@ simdjson_inline bool string_builder::capacity_check(size_t upcoming_bytes) { return is_valid; } -simdjson_inline void string_builder::grow_buffer(size_t desired_capacity) { +inline void string_builder::grow_buffer(size_t desired_capacity) { if (!is_valid) { return; } @@ -50548,7 +50518,7 @@ simdjson_inline void string_builder::append(const T &value) { #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template - requires(!std::is_convertible::value && !require_custom_serialization) + requires(!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void string_builder::append(const R &range) noexcept { auto it = std::ranges::begin(range); auto end = std::ranges::end(range); @@ -52073,7 +52043,7 @@ public: #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template -requires (!std::is_convertible::value && !require_custom_serialization) +requires (!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void append(const R &range) noexcept; #endif /** @@ -52151,7 +52121,7 @@ private: * If the allocation fails, is_valid is set to false. We expect * that this function would not be repeatedly called. */ - simdjson_inline void grow_buffer(size_t desired_capacity); + inline void grow_buffer(size_t desired_capacity); /** * We use this helper function to make sure that is_valid is kept consistent. @@ -52226,7 +52196,7 @@ namespace westmere { namespace builder { template - requires(concepts::container_but_not_string && !require_custom_serialization) + requires(concepts::container_but_not_string && ! concepts::optional_type && !require_custom_serialization) constexpr void atom(string_builder &b, const T &t) { auto it = t.begin(); auto end = t.end(); @@ -52334,7 +52304,7 @@ template requires(std::is_enum_v && !require_custom_serialization) void atom(string_builder &b, const T &e) { #if SIMDJSON_STATIC_REFLECTION - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { constexpr auto enum_str = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(enum_val))); if (e == [:enum_val:]) { @@ -52498,30 +52468,23 @@ string_builder& operator<<(string_builder& b, const Z& z) { template requires(std::is_class_v && (sizeof...(FieldNames) > 0)) void extract_from(string_builder &b, const T &obj) { - // Helper to check if a field name matches any of the requested fields - auto should_extract = [](std::string_view field_name) constexpr -> bool { - return ((FieldNames.view() == field_name) || ...); - }; - b.append('{'); bool first = true; - // Iterate through all members of T using reflection - template for (constexpr auto mem : std::define_static_array( - std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked()))) { - + static constexpr auto members = std::define_static_array(std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked())); + template for (constexpr auto mem : members) { if constexpr (std::meta::is_public(mem)) { - constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); + static constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); // Only serialize this field if it's in our list of requested fields - if constexpr (should_extract(key)) { + if constexpr (((FieldNames.view() == key) || ...)) { if (!first) { b.append(','); } first = false; // Serialize the key - constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); + static constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); b.append_raw(quoted_key); b.append(':'); @@ -53214,7 +53177,7 @@ simdjson_inline bool string_builder::capacity_check(size_t upcoming_bytes) { return is_valid; } -simdjson_inline void string_builder::grow_buffer(size_t desired_capacity) { +inline void string_builder::grow_buffer(size_t desired_capacity) { if (!is_valid) { return; } @@ -53551,7 +53514,7 @@ simdjson_inline void string_builder::append(const T &value) { #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template - requires(!std::is_convertible::value && !require_custom_serialization) + requires(!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void string_builder::append(const R &range) noexcept { auto it = std::ranges::begin(range); auto end = std::ranges::end(range); @@ -54550,7 +54513,7 @@ public: #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template -requires (!std::is_convertible::value && !require_custom_serialization) +requires (!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void append(const R &range) noexcept; #endif /** @@ -54628,7 +54591,7 @@ private: * If the allocation fails, is_valid is set to false. We expect * that this function would not be repeatedly called. */ - simdjson_inline void grow_buffer(size_t desired_capacity); + inline void grow_buffer(size_t desired_capacity); /** * We use this helper function to make sure that is_valid is kept consistent. @@ -54703,7 +54666,7 @@ namespace lsx { namespace builder { template - requires(concepts::container_but_not_string && !require_custom_serialization) + requires(concepts::container_but_not_string && ! concepts::optional_type && !require_custom_serialization) constexpr void atom(string_builder &b, const T &t) { auto it = t.begin(); auto end = t.end(); @@ -54811,7 +54774,7 @@ template requires(std::is_enum_v && !require_custom_serialization) void atom(string_builder &b, const T &e) { #if SIMDJSON_STATIC_REFLECTION - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { constexpr auto enum_str = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(enum_val))); if (e == [:enum_val:]) { @@ -54975,30 +54938,23 @@ string_builder& operator<<(string_builder& b, const Z& z) { template requires(std::is_class_v && (sizeof...(FieldNames) > 0)) void extract_from(string_builder &b, const T &obj) { - // Helper to check if a field name matches any of the requested fields - auto should_extract = [](std::string_view field_name) constexpr -> bool { - return ((FieldNames.view() == field_name) || ...); - }; - b.append('{'); bool first = true; - // Iterate through all members of T using reflection - template for (constexpr auto mem : std::define_static_array( - std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked()))) { - + static constexpr auto members = std::define_static_array(std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked())); + template for (constexpr auto mem : members) { if constexpr (std::meta::is_public(mem)) { - constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); + static constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); // Only serialize this field if it's in our list of requested fields - if constexpr (should_extract(key)) { + if constexpr (((FieldNames.view() == key) || ...)) { if (!first) { b.append(','); } first = false; // Serialize the key - constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); + static constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); b.append_raw(quoted_key); b.append(':'); @@ -55691,7 +55647,7 @@ simdjson_inline bool string_builder::capacity_check(size_t upcoming_bytes) { return is_valid; } -simdjson_inline void string_builder::grow_buffer(size_t desired_capacity) { +inline void string_builder::grow_buffer(size_t desired_capacity) { if (!is_valid) { return; } @@ -56028,7 +55984,7 @@ simdjson_inline void string_builder::append(const T &value) { #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template - requires(!std::is_convertible::value && !require_custom_serialization) + requires(!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void string_builder::append(const R &range) noexcept { auto it = std::ranges::begin(range); auto end = std::ranges::end(range); @@ -57050,7 +57006,7 @@ public: #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template -requires (!std::is_convertible::value && !require_custom_serialization) +requires (!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void append(const R &range) noexcept; #endif /** @@ -57128,7 +57084,7 @@ private: * If the allocation fails, is_valid is set to false. We expect * that this function would not be repeatedly called. */ - simdjson_inline void grow_buffer(size_t desired_capacity); + inline void grow_buffer(size_t desired_capacity); /** * We use this helper function to make sure that is_valid is kept consistent. @@ -57203,7 +57159,7 @@ namespace lasx { namespace builder { template - requires(concepts::container_but_not_string && !require_custom_serialization) + requires(concepts::container_but_not_string && ! concepts::optional_type && !require_custom_serialization) constexpr void atom(string_builder &b, const T &t) { auto it = t.begin(); auto end = t.end(); @@ -57311,7 +57267,7 @@ template requires(std::is_enum_v && !require_custom_serialization) void atom(string_builder &b, const T &e) { #if SIMDJSON_STATIC_REFLECTION - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { constexpr auto enum_str = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(enum_val))); if (e == [:enum_val:]) { @@ -57475,30 +57431,23 @@ string_builder& operator<<(string_builder& b, const Z& z) { template requires(std::is_class_v && (sizeof...(FieldNames) > 0)) void extract_from(string_builder &b, const T &obj) { - // Helper to check if a field name matches any of the requested fields - auto should_extract = [](std::string_view field_name) constexpr -> bool { - return ((FieldNames.view() == field_name) || ...); - }; - b.append('{'); bool first = true; - // Iterate through all members of T using reflection - template for (constexpr auto mem : std::define_static_array( - std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked()))) { - + static constexpr auto members = std::define_static_array(std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked())); + template for (constexpr auto mem : members) { if constexpr (std::meta::is_public(mem)) { - constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); + static constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); // Only serialize this field if it's in our list of requested fields - if constexpr (should_extract(key)) { + if constexpr (((FieldNames.view() == key) || ...)) { if (!first) { b.append(','); } first = false; // Serialize the key - constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); + static constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); b.append_raw(quoted_key); b.append(':'); @@ -58191,7 +58140,7 @@ simdjson_inline bool string_builder::capacity_check(size_t upcoming_bytes) { return is_valid; } -simdjson_inline void string_builder::grow_buffer(size_t desired_capacity) { +inline void string_builder::grow_buffer(size_t desired_capacity) { if (!is_valid) { return; } @@ -58528,7 +58477,7 @@ simdjson_inline void string_builder::append(const T &value) { #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template - requires(!std::is_convertible::value && !require_custom_serialization) + requires(!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void string_builder::append(const R &range) noexcept { auto it = std::ranges::begin(range); auto end = std::ranges::end(range); @@ -59554,7 +59503,7 @@ public: #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template -requires (!std::is_convertible::value && !require_custom_serialization) +requires (!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void append(const R &range) noexcept; #endif /** @@ -59632,7 +59581,7 @@ private: * If the allocation fails, is_valid is set to false. We expect * that this function would not be repeatedly called. */ - simdjson_inline void grow_buffer(size_t desired_capacity); + inline void grow_buffer(size_t desired_capacity); /** * We use this helper function to make sure that is_valid is kept consistent. @@ -59707,7 +59656,7 @@ namespace rvv_vls { namespace builder { template - requires(concepts::container_but_not_string && !require_custom_serialization) + requires(concepts::container_but_not_string && ! concepts::optional_type && !require_custom_serialization) constexpr void atom(string_builder &b, const T &t) { auto it = t.begin(); auto end = t.end(); @@ -59815,7 +59764,7 @@ template requires(std::is_enum_v && !require_custom_serialization) void atom(string_builder &b, const T &e) { #if SIMDJSON_STATIC_REFLECTION - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { constexpr auto enum_str = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(enum_val))); if (e == [:enum_val:]) { @@ -59979,30 +59928,23 @@ string_builder& operator<<(string_builder& b, const Z& z) { template requires(std::is_class_v && (sizeof...(FieldNames) > 0)) void extract_from(string_builder &b, const T &obj) { - // Helper to check if a field name matches any of the requested fields - auto should_extract = [](std::string_view field_name) constexpr -> bool { - return ((FieldNames.view() == field_name) || ...); - }; - b.append('{'); bool first = true; - // Iterate through all members of T using reflection - template for (constexpr auto mem : std::define_static_array( - std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked()))) { - + static constexpr auto members = std::define_static_array(std::meta::nonstatic_data_members_of(^^T, std::meta::access_context::unchecked())); + template for (constexpr auto mem : members) { if constexpr (std::meta::is_public(mem)) { - constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); + static constexpr std::string_view key = std::define_static_string(std::meta::identifier_of(mem)); // Only serialize this field if it's in our list of requested fields - if constexpr (should_extract(key)) { + if constexpr (((FieldNames.view() == key) || ...)) { if (!first) { b.append(','); } first = false; // Serialize the key - constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); + static constexpr auto quoted_key = std::define_static_string(constevalutil::consteval_to_quoted_escaped(std::meta::identifier_of(mem))); b.append_raw(quoted_key); b.append(':'); @@ -60695,7 +60637,7 @@ simdjson_inline bool string_builder::capacity_check(size_t upcoming_bytes) { return is_valid; } -simdjson_inline void string_builder::grow_buffer(size_t desired_capacity) { +inline void string_builder::grow_buffer(size_t desired_capacity) { if (!is_valid) { return; } @@ -61032,7 +60974,7 @@ simdjson_inline void string_builder::append(const T &value) { #if SIMDJSON_SUPPORTS_RANGES && SIMDJSON_SUPPORTS_CONCEPTS // Support for range-based appending (std::ranges::view, etc.) template - requires(!std::is_convertible::value && !require_custom_serialization) + requires(!std::is_convertible::value && !concepts::optional_type && !require_custom_serialization) simdjson_inline void string_builder::append(const R &range) noexcept { auto it = std::ranges::begin(range); auto end = std::ranges::end(range); @@ -65821,21 +65763,21 @@ public: * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit unsigned integer. */ - simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); /** * Cast this JSON value to a signed integer. * * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit integer. */ - simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); /** * Cast this JSON value to a double. * * @returns A double. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a valid floating-point number. */ - simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); /** * Cast this JSON value to a string. * @@ -65845,7 +65787,7 @@ public: * time it parses a document or when it is destroyed. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a raw_json_string. * @@ -65854,14 +65796,14 @@ public: * @returns A pointer to the raw JSON for the given string. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a bool. * * @returns A bool value. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not true or false. */ - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); /** * Cast this JSON value to a value when the document is an object or an array. * @@ -66447,12 +66389,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator array() & noexcept(false); simdjson_inline operator object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -66532,12 +66474,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator arm64::ondemand::array() & noexcept(false); simdjson_inline operator arm64::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator arm64::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator arm64::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator arm64::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -66618,12 +66560,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator arm64::ondemand::array() & noexcept(false); simdjson_inline operator arm64::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator arm64::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator arm64::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator arm64::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -68023,7 +67965,7 @@ error_code tag_invoke(deserialize_tag, ValT &val, T &out) noexcept { #if SIMDJSON_STATIC_REFLECTION std::string_view str; SIMDJSON_TRY(val.get_string().get(str)); - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { if (str == std::meta::identifier_of(enum_val)) { out = [:enum_val:]; @@ -69957,27 +69899,27 @@ simdjson_inline simdjson_result::operator arm64::onde } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator arm64::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator arm64::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -70346,27 +70288,27 @@ simdjson_inline simdjson_result::operator a } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator arm64::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator arm64::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -79097,21 +79039,21 @@ public: * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit unsigned integer. */ - simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); /** * Cast this JSON value to a signed integer. * * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit integer. */ - simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); /** * Cast this JSON value to a double. * * @returns A double. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a valid floating-point number. */ - simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); /** * Cast this JSON value to a string. * @@ -79121,7 +79063,7 @@ public: * time it parses a document or when it is destroyed. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a raw_json_string. * @@ -79130,14 +79072,14 @@ public: * @returns A pointer to the raw JSON for the given string. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a bool. * * @returns A bool value. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not true or false. */ - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); /** * Cast this JSON value to a value when the document is an object or an array. * @@ -79723,12 +79665,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator array() & noexcept(false); simdjson_inline operator object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -79808,12 +79750,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator fallback::ondemand::array() & noexcept(false); simdjson_inline operator fallback::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator fallback::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator fallback::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator fallback::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -79894,12 +79836,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator fallback::ondemand::array() & noexcept(false); simdjson_inline operator fallback::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator fallback::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator fallback::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator fallback::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -81299,7 +81241,7 @@ error_code tag_invoke(deserialize_tag, ValT &val, T &out) noexcept { #if SIMDJSON_STATIC_REFLECTION std::string_view str; SIMDJSON_TRY(val.get_string().get(str)); - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { if (str == std::meta::identifier_of(enum_val)) { out = [:enum_val:]; @@ -83233,27 +83175,27 @@ simdjson_inline simdjson_result::operator fallback } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator fallback::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator fallback::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -83622,27 +83564,27 @@ simdjson_inline simdjson_result::operato } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator fallback::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator fallback::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -92860,21 +92802,21 @@ public: * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit unsigned integer. */ - simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); /** * Cast this JSON value to a signed integer. * * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit integer. */ - simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); /** * Cast this JSON value to a double. * * @returns A double. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a valid floating-point number. */ - simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); /** * Cast this JSON value to a string. * @@ -92884,7 +92826,7 @@ public: * time it parses a document or when it is destroyed. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a raw_json_string. * @@ -92893,14 +92835,14 @@ public: * @returns A pointer to the raw JSON for the given string. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a bool. * * @returns A bool value. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not true or false. */ - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); /** * Cast this JSON value to a value when the document is an object or an array. * @@ -93486,12 +93428,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator array() & noexcept(false); simdjson_inline operator object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -93571,12 +93513,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator haswell::ondemand::array() & noexcept(false); simdjson_inline operator haswell::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator haswell::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator haswell::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator haswell::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -93657,12 +93599,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator haswell::ondemand::array() & noexcept(false); simdjson_inline operator haswell::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator haswell::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator haswell::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator haswell::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -95062,7 +95004,7 @@ error_code tag_invoke(deserialize_tag, ValT &val, T &out) noexcept { #if SIMDJSON_STATIC_REFLECTION std::string_view str; SIMDJSON_TRY(val.get_string().get(str)); - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { if (str == std::meta::identifier_of(enum_val)) { out = [:enum_val:]; @@ -96996,27 +96938,27 @@ simdjson_inline simdjson_result::operator haswell:: } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator haswell::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator haswell::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -97385,27 +97327,27 @@ simdjson_inline simdjson_result::operator } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator haswell::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator haswell::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -106623,21 +106565,21 @@ public: * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit unsigned integer. */ - simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); /** * Cast this JSON value to a signed integer. * * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit integer. */ - simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); /** * Cast this JSON value to a double. * * @returns A double. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a valid floating-point number. */ - simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); /** * Cast this JSON value to a string. * @@ -106647,7 +106589,7 @@ public: * time it parses a document or when it is destroyed. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a raw_json_string. * @@ -106656,14 +106598,14 @@ public: * @returns A pointer to the raw JSON for the given string. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a bool. * * @returns A bool value. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not true or false. */ - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); /** * Cast this JSON value to a value when the document is an object or an array. * @@ -107249,12 +107191,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator array() & noexcept(false); simdjson_inline operator object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -107334,12 +107276,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator icelake::ondemand::array() & noexcept(false); simdjson_inline operator icelake::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator icelake::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator icelake::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator icelake::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -107420,12 +107362,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator icelake::ondemand::array() & noexcept(false); simdjson_inline operator icelake::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator icelake::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator icelake::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator icelake::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -108825,7 +108767,7 @@ error_code tag_invoke(deserialize_tag, ValT &val, T &out) noexcept { #if SIMDJSON_STATIC_REFLECTION std::string_view str; SIMDJSON_TRY(val.get_string().get(str)); - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { if (str == std::meta::identifier_of(enum_val)) { out = [:enum_val:]; @@ -110759,27 +110701,27 @@ simdjson_inline simdjson_result::operator icelake:: } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator icelake::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator icelake::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -111148,27 +111090,27 @@ simdjson_inline simdjson_result::operator } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator icelake::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator icelake::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -120501,21 +120443,21 @@ public: * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit unsigned integer. */ - simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); /** * Cast this JSON value to a signed integer. * * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit integer. */ - simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); /** * Cast this JSON value to a double. * * @returns A double. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a valid floating-point number. */ - simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); /** * Cast this JSON value to a string. * @@ -120525,7 +120467,7 @@ public: * time it parses a document or when it is destroyed. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a raw_json_string. * @@ -120534,14 +120476,14 @@ public: * @returns A pointer to the raw JSON for the given string. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a bool. * * @returns A bool value. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not true or false. */ - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); /** * Cast this JSON value to a value when the document is an object or an array. * @@ -121127,12 +121069,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator array() & noexcept(false); simdjson_inline operator object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -121212,12 +121154,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator ppc64::ondemand::array() & noexcept(false); simdjson_inline operator ppc64::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator ppc64::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator ppc64::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator ppc64::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -121298,12 +121240,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator ppc64::ondemand::array() & noexcept(false); simdjson_inline operator ppc64::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator ppc64::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator ppc64::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator ppc64::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -122703,7 +122645,7 @@ error_code tag_invoke(deserialize_tag, ValT &val, T &out) noexcept { #if SIMDJSON_STATIC_REFLECTION std::string_view str; SIMDJSON_TRY(val.get_string().get(str)); - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { if (str == std::meta::identifier_of(enum_val)) { out = [:enum_val:]; @@ -124637,27 +124579,27 @@ simdjson_inline simdjson_result::operator ppc64::onde } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator ppc64::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator ppc64::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -125026,27 +124968,27 @@ simdjson_inline simdjson_result::operator p } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator ppc64::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator ppc64::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -134696,21 +134638,21 @@ public: * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit unsigned integer. */ - simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); /** * Cast this JSON value to a signed integer. * * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit integer. */ - simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); /** * Cast this JSON value to a double. * * @returns A double. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a valid floating-point number. */ - simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); /** * Cast this JSON value to a string. * @@ -134720,7 +134662,7 @@ public: * time it parses a document or when it is destroyed. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a raw_json_string. * @@ -134729,14 +134671,14 @@ public: * @returns A pointer to the raw JSON for the given string. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a bool. * * @returns A bool value. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not true or false. */ - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); /** * Cast this JSON value to a value when the document is an object or an array. * @@ -135322,12 +135264,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator array() & noexcept(false); simdjson_inline operator object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -135407,12 +135349,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator westmere::ondemand::array() & noexcept(false); simdjson_inline operator westmere::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator westmere::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator westmere::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator westmere::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -135493,12 +135435,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator westmere::ondemand::array() & noexcept(false); simdjson_inline operator westmere::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator westmere::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator westmere::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator westmere::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -136898,7 +136840,7 @@ error_code tag_invoke(deserialize_tag, ValT &val, T &out) noexcept { #if SIMDJSON_STATIC_REFLECTION std::string_view str; SIMDJSON_TRY(val.get_string().get(str)); - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { if (str == std::meta::identifier_of(enum_val)) { out = [:enum_val:]; @@ -138832,27 +138774,27 @@ simdjson_inline simdjson_result::operator westmere } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator westmere::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator westmere::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -139221,27 +139163,27 @@ simdjson_inline simdjson_result::operato } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator westmere::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator westmere::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -148365,21 +148307,21 @@ public: * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit unsigned integer. */ - simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); /** * Cast this JSON value to a signed integer. * * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit integer. */ - simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); /** * Cast this JSON value to a double. * * @returns A double. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a valid floating-point number. */ - simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); /** * Cast this JSON value to a string. * @@ -148389,7 +148331,7 @@ public: * time it parses a document or when it is destroyed. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a raw_json_string. * @@ -148398,14 +148340,14 @@ public: * @returns A pointer to the raw JSON for the given string. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a bool. * * @returns A bool value. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not true or false. */ - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); /** * Cast this JSON value to a value when the document is an object or an array. * @@ -148991,12 +148933,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator array() & noexcept(false); simdjson_inline operator object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -149076,12 +149018,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator lsx::ondemand::array() & noexcept(false); simdjson_inline operator lsx::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator lsx::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator lsx::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator lsx::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -149162,12 +149104,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator lsx::ondemand::array() & noexcept(false); simdjson_inline operator lsx::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator lsx::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator lsx::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator lsx::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -150567,7 +150509,7 @@ error_code tag_invoke(deserialize_tag, ValT &val, T &out) noexcept { #if SIMDJSON_STATIC_REFLECTION std::string_view str; SIMDJSON_TRY(val.get_string().get(str)); - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { if (str == std::meta::identifier_of(enum_val)) { out = [:enum_val:]; @@ -152501,27 +152443,27 @@ simdjson_inline simdjson_result::operator lsx::ondemand } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator lsx::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator lsx::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -152890,27 +152832,27 @@ simdjson_inline simdjson_result::operator lsx } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator lsx::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator lsx::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -162057,21 +161999,21 @@ public: * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit unsigned integer. */ - simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); /** * Cast this JSON value to a signed integer. * * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit integer. */ - simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); /** * Cast this JSON value to a double. * * @returns A double. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a valid floating-point number. */ - simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); /** * Cast this JSON value to a string. * @@ -162081,7 +162023,7 @@ public: * time it parses a document or when it is destroyed. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a raw_json_string. * @@ -162090,14 +162032,14 @@ public: * @returns A pointer to the raw JSON for the given string. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a bool. * * @returns A bool value. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not true or false. */ - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); /** * Cast this JSON value to a value when the document is an object or an array. * @@ -162683,12 +162625,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator array() & noexcept(false); simdjson_inline operator object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -162768,12 +162710,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator lasx::ondemand::array() & noexcept(false); simdjson_inline operator lasx::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator lasx::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator lasx::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator lasx::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -162854,12 +162796,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator lasx::ondemand::array() & noexcept(false); simdjson_inline operator lasx::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator lasx::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator lasx::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator lasx::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -164259,7 +164201,7 @@ error_code tag_invoke(deserialize_tag, ValT &val, T &out) noexcept { #if SIMDJSON_STATIC_REFLECTION std::string_view str; SIMDJSON_TRY(val.get_string().get(str)); - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { if (str == std::meta::identifier_of(enum_val)) { out = [:enum_val:]; @@ -166193,27 +166135,27 @@ simdjson_inline simdjson_result::operator lasx::ondema } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator lasx::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator lasx::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -166582,27 +166524,27 @@ simdjson_inline simdjson_result::operator la } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator lasx::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator lasx::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -175753,21 +175695,21 @@ public: * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit unsigned integer. */ - simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); /** * Cast this JSON value to a signed integer. * * @returns A signed 64-bit integer. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a 64-bit integer. */ - simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); /** * Cast this JSON value to a double. * * @returns A double. * @exception simdjson_error(INCORRECT_TYPE) If the JSON value is not a valid floating-point number. */ - simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); /** * Cast this JSON value to a string. * @@ -175777,7 +175719,7 @@ public: * time it parses a document or when it is destroyed. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator std::string_view() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a raw_json_string. * @@ -175786,14 +175728,14 @@ public: * @returns A pointer to the raw JSON for the given string. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not a string. */ - simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; + explicit simdjson_inline operator raw_json_string() noexcept(false) simdjson_lifetime_bound; /** * Cast this JSON value to a bool. * * @returns A bool value. * @exception simdjson_error(INCORRECT_TYPE) if the JSON value is not true or false. */ - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); /** * Cast this JSON value to a value when the document is an object or an array. * @@ -176379,12 +176321,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator array() & noexcept(false); simdjson_inline operator object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -176464,12 +176406,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator rvv_vls::ondemand::array() & noexcept(false); simdjson_inline operator rvv_vls::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator rvv_vls::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator rvv_vls::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator rvv_vls::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -176550,12 +176492,12 @@ public: explicit simdjson_inline operator T() noexcept(false); simdjson_inline operator rvv_vls::ondemand::array() & noexcept(false); simdjson_inline operator rvv_vls::ondemand::object() & noexcept(false); - simdjson_inline operator uint64_t() noexcept(false); - simdjson_inline operator int64_t() noexcept(false); - simdjson_inline operator double() noexcept(false); - simdjson_inline operator std::string_view() noexcept(false); - simdjson_inline operator rvv_vls::ondemand::raw_json_string() noexcept(false); - simdjson_inline operator bool() noexcept(false); + explicit simdjson_inline operator uint64_t() noexcept(false); + explicit simdjson_inline operator int64_t() noexcept(false); + explicit simdjson_inline operator double() noexcept(false); + explicit simdjson_inline operator std::string_view() noexcept(false); + explicit simdjson_inline operator rvv_vls::ondemand::raw_json_string() noexcept(false); + explicit simdjson_inline operator bool() noexcept(false); simdjson_inline operator rvv_vls::ondemand::value() noexcept(false); #endif simdjson_inline simdjson_result count_elements() & noexcept; @@ -177955,7 +177897,7 @@ error_code tag_invoke(deserialize_tag, ValT &val, T &out) noexcept { #if SIMDJSON_STATIC_REFLECTION std::string_view str; SIMDJSON_TRY(val.get_string().get(str)); - constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); + static constexpr auto enumerators = std::define_static_array(std::meta::enumerators_of(^^T)); template for (constexpr auto enum_val : enumerators) { if (str == std::meta::identifier_of(enum_val)) { out = [:enum_val:]; @@ -179889,27 +179831,27 @@ simdjson_inline simdjson_result::operator rvv_vls:: } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator rvv_vls::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator rvv_vls::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -180278,27 +180220,27 @@ simdjson_inline simdjson_result::operator } simdjson_inline simdjson_result::operator uint64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_uint64(); } simdjson_inline simdjson_result::operator int64_t() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_int64(); } simdjson_inline simdjson_result::operator double() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_double(); } simdjson_inline simdjson_result::operator std::string_view() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_string(); } simdjson_inline simdjson_result::operator rvv_vls::ondemand::raw_json_string() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_raw_json_string(); } simdjson_inline simdjson_result::operator bool() noexcept(false) { if (error()) { throw simdjson_error(error()); } - return first; + return first.get_bool(); } simdjson_inline simdjson_result::operator rvv_vls::ondemand::value() noexcept(false) { if (error()) { throw simdjson_error(error()); } @@ -185786,6 +185728,12 @@ consteval std::pair parse_double(const char *src, } } // namespace number_parsing +consteval auto make_data_member_options(auto&& name_str) { + std::meta::data_member_options options{}; + options.name = std::forward(name_str); + return options; +} + // JSON string may contain embedded nulls, and C++26 reflection does not yet // support std::string_view as a data member type. As a workaround, we define // a custom type that holds a const char* and a size. @@ -185840,7 +185788,8 @@ using class_type = type_builder::constructed_type; /** * @brief Variable template for constructing instances with values */ -template constexpr auto construct_from = T{Vs...}; +template constexpr T construct_from = T{Vs...}; + // in JSON, there are only a few whitespace characters that are allowed // outside of objects, arrays, strings, and numbers. @@ -185930,7 +185879,7 @@ parse_number(std::string_view json, std::from_chars(json.data(), json.data() + json.size(), int_value); if (res.ec == std::errc()) { out = int_value; - if ((res.ptr - json.data()) != scope) { + if (static_cast(res.ptr - json.data()) != scope) { simdjson_consteval_error( "Internal error: cannot agree on the character range of the float"); } @@ -185944,7 +185893,7 @@ parse_number(std::string_view json, std::from_chars(json.data(), json.data() + json.size(), uint_value); if (res.ec == std::errc()) { out = uint_value; - if ((res.ptr - json.data()) != scope) { + if (static_cast(res.ptr - json.data()) != scope) { simdjson_consteval_error( "Internal error: cannot agree on the character range of the float"); } @@ -186053,7 +186002,7 @@ parse_string(std::string_view json) { // present, we have an error (isolated high surrogate), which we // tolerate by substituting the substitution_code_point. if (end - cursor < 6 || *cursor != '\\' || - *(cursor + 1) != 'u' > 0xFFFF) { + *(cursor + 1) != 'u') { code_point = substitution_code_point; } else { // we have \u following the high surrogate cursor += 2; // skip \u @@ -186407,10 +186356,19 @@ parse_json_array_impl(const std::string_view json) { std::size_t count = values.size() - 1; // We assume all elements have the same type as the first element. // However, if the array is heterogeneous, we should use std::variant. + auto elem_type = std::meta::type_of(values[1]); + // String literals reflected via reflect_constant_string have type const + // char[N], but when passed as template auto parameters they decay to + // const char*. Use const char* as the element type so that + // construct_from can aggregate-initialize the array. + if (std::meta::is_array_type(elem_type) && + std::meta::remove_all_extents(elem_type) == ^^const char) { + elem_type = ^^const char *; + } auto array_type = std::meta::substitute( ^^std::array, { - std::meta::type_of(values[1]), std::meta::reflect_constant(count)}); + elem_type, std::meta::reflect_constant(count)}); // Create array instance with values values[0] = array_type; @@ -186477,8 +186435,7 @@ parse_json_object_impl(std::string_view json) { simdjson_consteval_error("Expected '}'"); } cursor += object_size; - auto dms = std::meta::data_member_spec(std::meta::type_of(parsed), - {.name = field_name}); + auto dms = std::meta::data_member_spec(std::meta::type_of(parsed), make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(parsed); @@ -186487,8 +186444,7 @@ parse_json_object_impl(std::string_view json) { case '[': { std::string_view value(cursor, end); auto [parsed, array_size] = parse_json_array_impl(value); - auto dms = std::meta::data_member_spec(std::meta::type_of(parsed), - {.name = field_name}); + auto dms = std::meta::data_member_spec(std::meta::type_of(parsed), make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(parsed); if (*(cursor + array_size - 1) != ']') { @@ -186509,8 +186465,7 @@ parse_json_object_impl(std::string_view json) { } } auto dms = - std::meta::data_member_spec(^^const char *, { - .name = field_name}); + std::meta::data_member_spec(^^const char *, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant_string(value)); break; @@ -186521,8 +186476,7 @@ parse_json_object_impl(std::string_view json) { } cursor += 4; - auto dms = std::meta::data_member_spec(^^bool, { - .name = field_name}); + auto dms = std::meta::data_member_spec(^^bool, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant(true)); break; @@ -186533,8 +186487,7 @@ parse_json_object_impl(std::string_view json) { } cursor += 5; - auto dms = std::meta::data_member_spec(^^bool, { - .name = field_name}); + auto dms = std::meta::data_member_spec(^^bool, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant(false)); break; @@ -186545,9 +186498,7 @@ parse_json_object_impl(std::string_view json) { } cursor += 4; - auto dms = std::meta::data_member_spec(^^std::nullptr_t, - { - .name = field_name}); + auto dms = std::meta::data_member_spec(^^std::nullptr_t, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant(nullptr)); break; @@ -186571,22 +186522,19 @@ parse_json_object_impl(std::string_view json) { if (std::holds_alternative(out)) { int64_t int_value = std::get(out); auto dms = - std::meta::data_member_spec(^^int64_t, { - .name = field_name}); + std::meta::data_member_spec(^^int64_t, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant(int_value)); } else if (std::holds_alternative(out)) { uint64_t uint_value = std::get(out); auto dms = - std::meta::data_member_spec(^^uint64_t, { - .name = field_name}); + std::meta::data_member_spec(^^uint64_t, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant(uint_value)); } else { double float_value = std::get(out); auto dms = - std::meta::data_member_spec(^^double, { - .name = field_name}); + std::meta::data_member_spec(^^double, make_data_member_options(field_name)); members.push_back(std::meta::reflect_constant(dms)); values.push_back(std::meta::reflect_constant(float_value)); } @@ -186631,16 +186579,11 @@ template consteval auto parse_json() { "Only JSON objects and arrays are supported at the top level, this " "limitation will be lifted in the future.");*/ - constexpr auto result = json.front() == '[' - ? parse_json_array_impl(json) - : parse_json_object_impl(json); - return [: result.first :]; - /* - if(json.front() == '[') { - return [:parse_json_array_impl(json).first:]; - } else if(json.front() == '{') { - // return [:parse_json_object_impl(json).first:]; - }*/ + if constexpr (json.front() == '[') { + return [: parse_json_array_impl(json).first :]; + } else { + return [: parse_json_object_impl(json).first :]; + } } } // namespace compile_time diff --git a/singleheader/singleheader.zip b/singleheader/singleheader.zip index 1e8296232f3db10f61ec2b485a814b16f1933af2..8ce2169b448602610cd005b0e6ba879b4e9ce87d 100644 GIT binary patch delta 10861 zcmd5?3s{p^nr@I=0zwoNFI;|55vpL2)(dJ)QL$1hLE@zlBoTfD4IzeLL@)#qW0Y!4 z$9z(dV9VI?ak{2E)iX2Q9n2($LmGHUbz$Ej*BLYMi zVhkc25rK$AL?NOPLWBqrgNQ|pMZ_WE5n{wR#CSvkA`vkGF%gl3@QptiF$FOdk&H+| zq$1J~3?dzoftZGvj+lYSM9f5Fk%LFFU)vDp+vxSNJI@SSnjadpK>3yI+>pJRZCA31 z?aIULJ>Rum98Rz`+T40@7GgFc2a$`IgODKd5OWdvh({2QBIY6HBNiYQA_@?T5Q`B@ z5RW02BBZ4C;N!(=xSU@!Nw5|=rWZ~lCez9S5xl36#gg4A%Ob;IAfnI#uB4)i1WU1z z0tQMKFH3`-q{4KN;AZRs8d?%cuw z*#4KDNio~lmTac2jmgc;1?I;qTRA0}>}UkhKDq2>7&vD{L=sVcp=LAbI9fO;xocOR zHBY=M2IZ8w1>o7SJRX>9t5=c3e<<9u=q|OpH~*|~bZ+)#_P#sR?$2Ms?-0J0Zi)uk zH&q$nyI3Seo{=%s+< z(U@rR;=e3^?*0@&mBk?kq?x-V2CjWpml`~v2Ip+MMV!dG*fe2 z=%Kkc6-9wm&=^i!SBqZw4(>d5XrBOsEAQt$3cq~dH-_843>T69 zl2x6f_e0CFCkn|P<0|KUt>dU{aj5r5b$1~1Pq#;s@@d6QdmnfJWa%r#?C9OQxGgRG z+~wlJ`)(ajV?od{6hr*Q1CeBt`AOCO2W}gVrK~>AxkfBSj$+sN+wchTRq^VL_dfy2 zZ^QGzdElueg3&Rp`@#E8wLIky30NA%Awjk)Gn&}XJ@o+ZW{r??-fdsSntc@|`zmDT zDoT?kz$@DF43KC`FL5Q)ANBvrl|0+alflcVwgJ=uZ#W((n;wdIqE_}aeh0$v8| zpY{0Lt)-Hl7O?3?P zWt1)k@p!oim;=VyV3Nrv6VoT9yMgMopvbTEAs5l;Ks^R4+n>$M-3 zM1ZNsG9H{qjRc(EluRPpo23oo|BvU8ja{4e7r1_~ZXD(*nBNW5?-wM4G6Glg_TOdE z=I)p>(j6oJavXR{ZF%6nU6u^46gdmBgJlvhHY3EUQb*?vT{yC}0 z#8(QzvlExaPs}&0K3+x-zJ{AU(6E`CI3Nnmv8{5%I>dU!2E;}Z+xqn6y}@rVI_T+K zRG|Uc_Z6aZt>ueE!Nm=Wgm;V^7xL6YDbap>LkRPTyRZCeIG9#jKL&AZRT9YhjE{lm z#)d>-qAH`o{j#wHm^D@aR7?R`;#xUZa=yO19G0GadLwc78__bYnyM@?m0E?MKEJUL zJfA2MpgnAD4mf94B!cz>#Vn9+ZMK8*Ld6u~Y%7Nd;_6f{7r^*oCF?YF9WWR6xpDa$;I^h z5d1!dnf}xGt0E8HIoVsunV;7uw!he`;7p#1mv+i)LoAQh-4<3(xaTB%eXDlK%Q?#n z>IDu!15W z3*HmPTyQJvrjo{I%YQxwwCS6t6YGKMiDQBvU|0_4zq7l6dm@rqa=3;_4zm{$C@JkH z*qPwkW>Zj3Qc064ub`BqlIb;5NG!mr0w|fmashxU1Wd6IBrmXu@M$`pMc~v2z}m{D z0<}Y0qISsDp&b(KDfUJgXB@Jx*gW|4NwfwU52%3X3A z1q<<$OaL0p?pjcYUEn9o2I*zP53rC0aUU2u!4u6cp&c)MU>FRMUg|v!*Y@C-mFaC_ zpE|jA-Lg|aOS_%D83OovHX8-b=WAzyEU9t|SPs|Z*smHCpnjn?2V_6$#aE2K=0*^c zpz+sX;ObW~q%pj4VSyPrkJy5!L)0U-5_i!y>kC0@j1JqBUanUI)1naqnxzO*#y3bg zG3|gc2i(6=C-}r@z+~Sj2gAg3gsLygSm-c61<9eVa z&z({Qm^!y^@W))!?=+l!lk;ur^Z$RVM<+crqx{BL9|Oxzx37US=Nh8G)TPY?*Xi~r zd}0iUH#BAt>%RTR$Cw8WHjsgXnmml4zJycTid$m33^e-WfvH`S0(>l{t=2)-AAMGR zp~&P^#K$!zF8WfHMvcuMb9^E(_G@1AXP9_ol3;Ypv%jlBzY@$XX(J!pe8W=>%t(_# ztX79cd8*6DHY)zZ4Gm@kehP#bvDtG=gJ?u(5!(?u;YSlN-zbA&koCclH z?9uHY9-ZN)|3V{aGK5}esL1n+ihQp3C!Jv)I6Dn9K)I0x%bfZx&O_8FRUJe z|E?9#^WSy?BL0=Y6S69vob$nb!4hZ25QEr>XhG~kv?AJw^zv@!!=sF)&R?}@!1IcU zvJ?vbX2k0TN(67~ACByfZa-=axg8C3wd61e41n^KDUC~%Xo)6DT%GU2 zLQC|*V*R^mC6T>p+8oH6!aK5uUhHMQI-cNE971sVqQEyCn%r^Eq64jdz6V4hQ02hN zdA_FtRgr|%p5jV0r^5Bhf#y?O33Dm4JEH@!2hoYxi|8WmjD4rx3UXo;IPDuz;QC=# zHIZ&H-x(SAp|PRs5#Cp$6i>8fa|g12we<>!&zr-+{fzl#UnX)4n3wlsrs~T?ye(Z5 z&$XIA8ewGk_Sw=yytWzNqVPS+QZSoK1qSw6ri5I}smQx(D)O$HG9}PM2(v%8G;#R= zU&k{$SVz=77Ueo_I`3x|i~q{|nI#AKtR5S3hCVjYI^#r3Jb3q+Ln8xi2;}#3fY-yL zO)|T_upkZ~4kEe{&k)xahu(dAG*PO4gyH$l(^fHPmwpe=LZ_O@Gm6$L7aR(S{va*3 zCUG}gQ`6xrB7MU8>A2wDhvQ=5e>R&me5eP;bwq;fybb?&>wEb^QB2x5Ti^coyFGAN zvRP4ngeb~w$^J~jTW6ad;&`QMTf6^>#Mdyy=UN+V$NaBDzE+-!*zgDh4(S98th7zV zH)Bl{oH?u53rf8$mCG2E>#+ed26VE%5<1zv;C|Bfc*v`e>4PKlL94fo=U#=*yls;L zy5K0%uD2D-{OR>uw%m~WtJWv-OsC?I`zzKx#(iD>g^TJ1Np40F@hswdh@%KQ(Y^(< z-VJ`)QQ#=?nSWqBs6i?1<+9t|Nj=j?=)<(>Jqh5w2t%1p>!nBSAxu9vz2_$*w4;%Y ze(4@2yWf1y|28DcgSjCI#o?trgMYr8&iLl4^&-qV?XA5oM8PDqlPHX^}xxJ|bQ{=0hFSfV$ zW(~;}XjL#-pwhSG3Vi*yEF{p#WeNdF2vjw&mXJh&YWVU5TA*oybbs$!E=};2%$Hv3 zMf4$#lS?o4pDcvOt9B)3)u{BUss^@UGpnm=)avUSHBDKnW_@F3CZka`uvPert8AuK z#K7Zg9FyAp8jSz{t-BYAn1GP$(`S}2P5PRGg4#x%L8Yr%T*FqY^(|U9D>&F=e9_lg z$LgDPn!p%~M7u?zIdhoevXV78kgi^{g=tW=Fx8D3y{cYA9NzxMs1&(R#@6O)eO0Zl zu>mKQx2|u(Uj*TLNY2gvuozJNUND(R#yGABXc4e@izGxkUWylF!#lc+Nf37+4nO`dzqw97Uzmsao)P_{f`8X$ig|t9-l4W->EzEc^%QJ-ZUt zsMP8zcBdYvYsv~yTC#-Mw26Kcx;Dxf>=V?$FBIC&JnTE--6Ck2@5qB=D;!KrP<1u~ zzxlF1g?zcf(G@)dzy3D1>f1 zOrDmMI4wyw1yZiZ&EDF2s@3hDiELxrXyw`W+G-Gk`T#=*@!ua6vT@NIWFDYla+8NHZ_#o ziLXpygdX|r((opTGqUtwS$;TxNqhidt)#o!}p{ea9Kzc1E1AGqLH%EULrE_ zLfW3ejO4Xu11{$Zcx&2vPcYfj+)u0Lr&|WGn_LP=Z+v#EN#yD2`v|ZGh-<(uBm?1Fmn9;49(LGPyKc<^L}Qo_X2tLf=)^R zf+y+9Gu(Sy;Ak<)tX(iDK|wVpd5*B8d%vvnffE0QFtC|2gNR%@J9h}!ieB=99h&+6 z#6B+bS6iPtn~maUcd{gV8Fym*GBfq*>xzy5wPp&2|DkcaC%MsrJ2=67=fp|HS|1lrc6fkb;FJ4ggJWyKvxxS2H)tk&EJFlkDrf&9DdiNKU( zc>tHzaS^y{S%GHd8zX`FSG^bX7;B?}`M<1iu$n4G(D#?DHK6!QRuago)LEdtn;i*X zq<6?c)|rz8R$YEPSnuF$v>S^O4r2)y=l}7G1izRz1gshC7&yLTO)6+1%L^256zTX` zd78`fhJ*cH_95U(P2F^&q^C0{+>P|^Qg^z6cT%<(zNl8jKu!Opj6wg@;(><8@gpJ6E~X$uDvm z7m;>bv@e(LX9uVv@}%(Me&fo&t0L_20gV;3WAmb*_kgj1ew_R{GS8eRbkSDjC4eS_ z;{Z$BTj^iOT*a_`T~%7>lwfXxj-alRDp$G6WtB_c0jfD$2aM-gW@=F~U_ZughraE~ za6p#5_OK3vw13fb3k`igVe3J$TbT*mA>%<>GDjoFx{{RWSoSKtiTr2E*D%uNZRUIm z!UTe`RZee+H6&>OnWj~7Ms1^|UG8$_=FqB0h( z^nh@c?lzgax#&ALflP|(qM4L?MABaLUmk!w`wIGQsKlV^W~r-80aGL!43dMjS5F^X zJBND88E)`Eqe}wjPi!qtsFdl60N{UKM+hCS{Nopl5Jbm%$#A+KUS#)g1Iw)b&B-0AjIDmqS6vhUru&)}eq~|>&qqsw=Mxn# zGoZgitVg_z*nlV@CeMvcSAPu5!UP2)f=|^8p>I~HBe>XdZG&78X>cK#Sc>zURqEiE z?R4oFSY2RB21QeeA1KzB_=DX&6GRJJiSA1%6_K7&%f>1M=7Ne@#$)l$I*xrWlYl z8N@)1mwcje(2^RD;wa#b)E?GEwo)A^ zoU4CwW>>$Yr@?^H0kM{8&L;p9shI)XJ`FDCA$HY6Q3{m(v{llr+5E5}1|-|n5zxC& z(<)s50|Ven;EEFNfab_DK^qqUN9DaHz2$qaYhqoTs4(;w6yLK>x6bdeiX$FR1gzy1 zw|H{n{l&+r@^uw~fN|b>l7FC(JmBqicS~ptaJKlXWcIgDiXmS zoVOmFbpsTg4Dvtf!vIwowP*R$(8Eog6+QX9oz;iDSp>}#vs3;M^qs; zBVI*pK~xj@jhf1s=gzxVMhX6>bysx>vF)w3p`+r{uL1emlT_n#Bh}|MULYG=k0IvK z>P;@p!-imid9=j5RejRIyy0Keh|J&AO#s!OYQw;^yv~s+aX+sW0T)>l&8JJd9^v8Q z_qO;LuAQhO*G_QVGyshP6XC)izv`WJP9D-aCl8$}n)93#F86EJ3Cy7lJ^S%Ji$)TU z>GgJ3JBY|PIEhHrgy>YLKPni;$EBx#%^h{nvUhb|2=v|71VC8^w-ap9Tf-hko|sMX zttMUGXmB#pS*IAcmB!7kdX$mO0&c1SheEuDs7Ev)8i_5s>D&K!zKpW1H$;yjy_JoH zg8PEdEe2n(-fVDO(Y;$6M>}5%@QRKyzuSxnKv(TtS}^GwL!mdvgi(N}(O-Bm;A#vJ zU{CLO5qcXMBY^SENfS!^iveGXCQO~-r0;Y2?C2-n4w!9?-#k1J`-OQ>SIo~H?BUJF z9S1_x)i{ZNHW&>nqMPG{XM;1ZH^w=h4Q%D%61e$svkzgqi{6bjZ%Rod_;hg4^<4li zEok-xDchC>rQ?lwD=+2zz{0johsEyOVxcD~*N1RExot!7!D(Q$p8c!T5#|fc>oJ!r z9SsjsxA}s7XM+dPo@(CpHK@9b8A5_bOY}g|5>4x9sjS;rA?VR$ZlG>ppLw@!KWL03 z_*$?nk5^27cn0dA_m(kUI0Ll7Nq?s(yJhr+UY)@u1*5$v`>nT(i-BtJtTJ%@M#MJ6 zcEk=u3*q`(|L6IigMae`)xNeV=G4|iFl}rXqGR&beA68<-~qV{eVMJS5XaukY{mcN z$!--636ZTgopnU6suiunz+Tw;Dvex0Rrh)@a4n6wVEfK=p68Jxvm&-trjPKF{GoAw z@kiHtUS8PZZji8TM8dX@840RO?X$tOqVr{;qzcLN5u!)hVBMkLB-QO_bNMbgLVRf>?c-eHOWHskB$jaK zM?UG)6-)BWb?rA=q30*Qk~@Ty z<*9~VdE_NYve@ixXiD2dn$kMYViNeIt<&4(`hKjAdK+gQy}q3yeYrfB->G*Q ziqh>#6=Cg!5R#kT8RopXc}aLza?~FMTE*Yoq^GcRS*|d;{5a~-dg4w5Jyry8b{I+jU#1kovv9975OX&w>MaL z=;U=BnGP+|Ovg}nwiB@zv5(Z9?Yf#m!tQq&J>A#nD$C%Ahb8pzc@K*>*hg9Jz-J>Z zeFRH~B~Tb;@rU^R{yw1E6c$S^jJ2={kTTyg9>y)TFmQ1V_G#JovIrLDTD*o#WWa5m zC4{J#TAD=gQ$`xLlN&3MZkeQ6Q_3=PnBonrdR-we)WD`f%WBZAw)}2zJ%V}-L!f)8 zCCQ&*o-)uO>mA0JW_n0YXD|G5g+=P;fGR>so@-j_jY#cLZ4imE~1|nYa2zPrC3d=1a z5IMsV?v@0q3`<}UeBZ|pJ} tire_pressure; + std::string make{}; + std::string model{}; + int64_t year{}; + std::vector tire_pressure{}; }; struct kid { - int age; - std::string name; - std::vector toys; + int age{}; + std::string name{}; + std::vector toys{}; bool operator<=> (const kid&) const = default; }; struct Z { - int x; + int x{}; bool operator<=> (const Z&) const = default; }; struct Y { - int g; - std::string h; - std::vector i; - Z z; + int g{}; + std::string h{}; + std::vector i{}; + Z z{}; bool operator<=> (const Y&) const = default; }; struct X { - char a; - int b; - int c; - std::string d; - std::vector e; - std::vector f; - Y y; + char a{}; + int b{}; + int c{}; + std::string d{}; + std::vector e{}; + std::vector f{}; + Y y{}; bool operator<=> (const X&) const = default; }; diff --git a/tests/builder/static_reflection_comprehensive_tests.cpp b/tests/builder/static_reflection_comprehensive_tests.cpp index 33600be4a..0b957943e 100644 --- a/tests/builder/static_reflection_comprehensive_tests.cpp +++ b/tests/builder/static_reflection_comprehensive_tests.cpp @@ -16,8 +16,8 @@ namespace builder_tests { #if SIMDJSON_STATIC_REFLECTION // Custom type for testing tag_invoke with extract_into struct Price { - double amount; - std::string currency; + double amount{}; + std::string currency{}; // Custom deserializer that applies currency conversion friend error_code tag_invoke(deserialize_tag, @@ -46,17 +46,37 @@ namespace builder_tests { return SUCCESS; } }; - + struct Car { + std::string make{}; + std::string model{}; + int year{}; + double price{}; + bool electric{}; + }; + struct CarOpt { + std::string make; + std::string model; + int year; + double price; + std::optional color; + }; + struct CarColor { + std::string make; + std::string model; + int year; + double price; + std::string color; + }; struct Product { - std::string name; - Price price; // Custom deserializable type - int stock; + std::string name{}; + Price price{}; // Custom deserializable type + int stock{}; }; // Another custom type for testing struct Dimensions { - double value; - std::string unit; + double value{}; + std::string unit{}; // Custom deserializer that converts to metric friend error_code tag_invoke(deserialize_tag, @@ -89,6 +109,13 @@ namespace builder_tests { Dimensions weight; Dimensions length; }; + + struct Person { + std::string name; + int age; + std::optional email; + std::optional phone; + }; #endif bool test_primitive_types() { @@ -132,8 +159,8 @@ namespace builder_tests { TEST_START(); #if SIMDJSON_STATIC_REFLECTION struct StringTypes { - std::string string_val; - std::string_view string_view_val; + std::string string_val{}; + std::string_view string_view_val{}; }; StringTypes test{"hello world", "test_view"}; @@ -159,10 +186,10 @@ namespace builder_tests { TEST_START(); #if SIMDJSON_STATIC_REFLECTION struct OptionalTypes { - std::optional opt_int_with_value; - std::optional opt_string_with_value; - std::optional opt_int_null; - std::optional opt_string_null; + std::optional opt_int_with_value{}; + std::optional opt_string_with_value{}; + std::optional opt_int_null{}; + std::optional opt_string_null{}; }; OptionalTypes test; @@ -200,11 +227,11 @@ namespace builder_tests { TEST_START(); #if SIMDJSON_STATIC_REFLECTION struct SmartPointerTypes { - std::unique_ptr unique_int_with_value; - std::shared_ptr shared_string_with_value; - std::unique_ptr unique_bool_with_value; - std::unique_ptr unique_int_null; - std::shared_ptr shared_string_null; + std::unique_ptr unique_int_with_value{}; + std::shared_ptr shared_string_with_value{}; + std::unique_ptr unique_bool_with_value{}; + std::unique_ptr unique_int_null{}; + std::shared_ptr shared_string_null{}; }; SmartPointerTypes test; @@ -245,9 +272,9 @@ namespace builder_tests { #if SIMDJSON_STATIC_REFLECTION // Test basic container types struct ContainerTypes { - std::vector int_vector; - std::set string_set; - std::map string_map; + std::vector int_vector{}; + std::set string_set{}; + std::map string_map{}; }; ContainerTypes test; @@ -278,8 +305,8 @@ namespace builder_tests { // Test std::list with iterator-based serialization struct ListContainer { - std::list int_list; - std::list string_list; + std::list int_list{}; + std::list string_list{}; }; ListContainer list_test; @@ -319,13 +346,7 @@ namespace builder_tests { bool test_extract_into() { TEST_START(); #if SIMDJSON_STATIC_REFLECTION - struct Car { - std::string make; - std::string model; - int year; - double price; - std::optional color; - }; + ondemand::parser parser; @@ -341,7 +362,7 @@ namespace builder_tests { "transmission": "Automatic" })"_padded; - Car car{}; + CarOpt car{}; ondemand::document doc; ASSERT_SUCCESS( parser.iterate(padded).get(doc) ); @@ -377,7 +398,7 @@ namespace builder_tests { "color": "Red" })"_padded; - Car car{}; + CarOpt car{}; ondemand::document doc; ASSERT_SUCCESS(parser.iterate(padded).get(doc)); @@ -402,7 +423,7 @@ namespace builder_tests { "price": 35999.99 })"_padded; - Car car{}; + CarOpt car{}; ondemand::document doc; ASSERT_SUCCESS(parser.iterate(padded).get(doc)); @@ -495,13 +516,6 @@ namespace builder_tests { #if SIMDJSON_STATIC_REFLECTION // Test 1: Extract specific fields from Car struct { - struct Car { - std::string make; - std::string model; - int year; - double price; - bool electric; - }; Car car{"Tesla", "Model 3", 2023, 42000.0, true}; @@ -533,13 +547,7 @@ namespace builder_tests { // Test 2: Extract different field combination { - struct Car { - std::string make; - std::string model; - int year; - double price; - bool electric; - }; + Car car{"Ford", "F-150", 2024, 55000.0, false}; @@ -566,13 +574,6 @@ namespace builder_tests { // Test 3: Extract from struct with optional fields { - struct Person { - std::string name; - int age; - std::optional email; - std::optional phone; - }; - Person person{"John Doe", 30, "john@example.com", std::nullopt}; // Extract name and email @@ -594,13 +595,6 @@ namespace builder_tests { // Test 4: Extract with optional that has value { - struct Person { - std::string name; - int age; - std::optional email; - std::optional phone; - }; - Person person{"Jane Smith", 25, "jane@example.com", "555-1234"}; // Extract name, age, and phone @@ -629,21 +623,21 @@ namespace builder_tests { // Test 5: Round-trip test - serialize with extract_from, deserialize with extract_into { - struct Product { - std::string id; - std::string name; - double price; - int stock; + struct MyProduct { + std::string id{}; + std::string name{}; + double price{}; + int stock{}; }; - Product original{"P123", "Widget", 19.99, 100}; + MyProduct original{"P123", "Widget", 19.99, 100}; // Extract specific fields to JSON std::string json; ASSERT_SUCCESS((extract_from<"id", "name", "price">(original).get(json))); // Parse and extract back - Product restored{"", "", 0.0, 0}; + MyProduct restored{"", "", 0.0, 0}; auto padded = pad(json); ondemand::parser parser; auto doc = parser.iterate(padded); diff --git a/tests/builder/static_reflection_custom_tests.cpp b/tests/builder/static_reflection_custom_tests.cpp index 1f4b53c4a..12ebe065c 100644 --- a/tests/builder/static_reflection_custom_tests.cpp +++ b/tests/builder/static_reflection_custom_tests.cpp @@ -11,10 +11,10 @@ using namespace simdjson; // Suppose that we want to serialize/deserialize Car using // strings for the year struct Car { - std::string make; - std::string model; - int64_t year; - std::vector tire_pressure; + std::string make{}; + std::string model{}; + int64_t year{}; + std::vector tire_pressure{}; }; diff --git a/tests/builder/static_reflection_edge_cases_tests.cpp b/tests/builder/static_reflection_edge_cases_tests.cpp index a41cf9133..6adb65a37 100644 --- a/tests/builder/static_reflection_edge_cases_tests.cpp +++ b/tests/builder/static_reflection_edge_cases_tests.cpp @@ -14,11 +14,11 @@ namespace builder_tests { TEST_START(); #if SIMDJSON_STATIC_REFLECTION struct EmptyValues { - std::string empty_string; - std::vector empty_vector; - std::optional null_optional; - std::unique_ptr null_unique_ptr; - std::shared_ptr null_shared_ptr; + std::string empty_string{}; + std::vector empty_vector{}; + std::optional null_optional{}; + std::unique_ptr null_unique_ptr{}; + std::shared_ptr null_shared_ptr{}; }; EmptyValues test; @@ -56,11 +56,11 @@ namespace builder_tests { TEST_START(); #if SIMDJSON_STATIC_REFLECTION struct SpecialChars { - std::string quotes; - std::string backslashes; - std::string newlines; - std::string unicode; - char null_char; + std::string quotes{}; + std::string backslashes{}; + std::string newlines{}; + std::string unicode{}; + char null_char{}; }; SpecialChars test; @@ -82,10 +82,10 @@ namespace builder_tests { // Test round-trip (excluding null char which has special handling) struct SpecialCharsNoNull { - std::string quotes; - std::string backslashes; - std::string newlines; - std::string unicode; + std::string quotes{}; + std::string backslashes{}; + std::string newlines{}; + std::string unicode{}; }; SpecialCharsNoNull test_no_null; @@ -157,15 +157,15 @@ namespace builder_tests { TEST_START(); #if SIMDJSON_STATIC_REFLECTION struct Inner { - int value; - std::string name; + int value{}; + std::string name{}; }; struct Outer { - Inner inner_obj; - std::vector inner_vector; - std::optional optional_inner; - std::unique_ptr unique_inner; + Inner inner_obj{}; + std::vector inner_vector{}; + std::optional optional_inner{}; + std::unique_ptr unique_inner{}; }; Outer test; diff --git a/tests/builder/static_reflection_enum_tests.cpp b/tests/builder/static_reflection_enum_tests.cpp index b25821848..15d10dedd 100644 --- a/tests/builder/static_reflection_enum_tests.cpp +++ b/tests/builder/static_reflection_enum_tests.cpp @@ -51,8 +51,8 @@ namespace builder_tests { }; struct StatusStruct { - Status status; - std::string name; + Status status{}; + std::string name{}; }; // Test deserialization of different enum values with string representation @@ -104,9 +104,9 @@ namespace builder_tests { }; struct Task { - Priority priority; - std::string description; - int id; + Priority priority{}; + std::string description{}; + int id{}; }; Task original{Priority::High, "Important task", 123}; @@ -144,8 +144,8 @@ namespace builder_tests { }; struct Response { - ErrorCode error; - std::string message; + ErrorCode error{}; + std::string message{}; }; Response test{ErrorCode::NotFound, "Resource not found"}; diff --git a/tests/builder/static_reflection_fractured_json_tests.cpp b/tests/builder/static_reflection_fractured_json_tests.cpp index fb3469a54..339d70655 100644 --- a/tests/builder/static_reflection_fractured_json_tests.cpp +++ b/tests/builder/static_reflection_fractured_json_tests.cpp @@ -8,26 +8,26 @@ using namespace simdjson; // Test structures for FracturedJson builder integration struct SimpleUser { - int id; - std::string name; - bool active; + int id{}; + std::string name{}; + bool active{}; }; struct UserWithEmail { - int id; - std::string name; - std::string email; - bool active; + int id{}; + std::string name{}; + std::string email{}; + bool active{}; }; struct NestedData { - std::string title; - std::vector users; - int count; + std::string title{}; + std::vector users{}; + int count{}; }; struct TableTestData { - std::vector records; + std::vector records{}; }; namespace fractured_json_builder_tests { diff --git a/tests/compile_time/compile_time_json_tests.cpp b/tests/compile_time/compile_time_json_tests.cpp index 160862d61..66a5383bf 100644 --- a/tests/compile_time/compile_time_json_tests.cpp +++ b/tests/compile_time/compile_time_json_tests.cpp @@ -666,27 +666,27 @@ bool test_array_of_objects_with_concept() { /** * Test: #embed support for external JSON files (C++26) */ -bool test_embed_twitter_json() { +bool test_embed_example_config_json() { TEST_START(); // C++26 #embed allows embedding files directly into the binary at compile time // This creates a const char array with the file contents plus null terminator - constexpr const char twitter_json[] = { - #embed TWITTER_JSON + constexpr const unsigned char example_config_json[] = { + #embed "../../jsonexamples/example_config.json" , 0 }; // Parse the embedded JSON at compile time - constexpr auto parsed_twitter = simdjson::compile_time::parse_json(); + constexpr auto parsed_example_config = simdjson::compile_time::parse_json(); - // Verify the structure - twitter.json should have a "statuses" array - static_assert(parsed_twitter.statuses.size() > 0); + // Verify the structure - example_config.json should have an "app_name" field + static_assert(std::string_view(parsed_example_config.app_name) == "MyApp"); // Runtime verification - ASSERT_TRUE(parsed_twitter.statuses.size() > 0); + ASSERT_TRUE(std::string_view(parsed_example_config.app_name) == "MyApp"); - std::cout << "Successfully parsed embedded twitter.json with " - << parsed_twitter.statuses.size() << " statuses" << std::endl; + std::cout << "Successfully parsed embedded example_config.json with " + << parsed_example_config.app_name << " as app_name" << std::endl; TEST_SUCCEED(); } @@ -718,11 +718,10 @@ bool run() { test_top_level_array_example() && test_array_of_objects_with_concept() #ifdef TEST_EMBED_SUPPORTED - && test_embed_twitter_json() + && test_embed_example_config_json() #endif ; } - } // namespace compile_time_json_tests int main(int argc, char *argv[]) { diff --git a/tests/ondemand/ondemand_convert_tests.cpp b/tests/ondemand/ondemand_convert_tests.cpp index 99af9db98..785a86823 100644 --- a/tests/ondemand/ondemand_convert_tests.cpp +++ b/tests/ondemand/ondemand_convert_tests.cpp @@ -19,7 +19,7 @@ public: return date_str; } private: - std::string date_str; + std::string date_str{}; }; @@ -52,8 +52,8 @@ auto tag_invoke(deserialize_tag, simdjson_value &val, MyDate& date) { } // namespace simdjson struct complicated_weather_data { - std::vector time; - std::vector temperature; + std::vector time{}; + std::vector temperature{}; }; @@ -152,19 +152,19 @@ simdjson::padded_string json_cars = TEST_SUCCEED(); } struct Player { - std::string username; - int level; - double health; + std::string username{}; + int level{}; + double health{}; }; struct BadPlayer { - int username; // Oops, should be string! - int level; - double health; + int username{}; // Oops, should be string! + int level{}; + double health{}; }; struct OptionalPlayer { - std::string username; - std::optional level; - double health; + std::string username{}; + std::optional level{}; + double health{}; }; #if SIMDJSON_STATIC_REFLECTION bool missing_key_player() { diff --git a/tests/ondemand/ondemand_wrong_type_error_tests.cpp b/tests/ondemand/ondemand_wrong_type_error_tests.cpp index 0f0d9aa2f..dbfd826bd 100644 --- a/tests/ondemand/ondemand_wrong_type_error_tests.cpp +++ b/tests/ondemand/ondemand_wrong_type_error_tests.cpp @@ -15,9 +15,9 @@ namespace wrong_type_error_tests { return false; \ } \ { \ - padded_string a_json(std::string(R"({ "a": )") + JSON + " }"); \ + std::string a_json(R"({ "a": )"); a_json += JSON; a_json += " }"; \ std::cout << R"(- Subtest: get_)" << (#TYPE) << "() - JSON: " << a_json << std::endl; \ - if (!test_ondemand_doc(a_json, [&](auto doc_result) { \ + if (!test_ondemand_doc(simdjson::pad(a_json), [&](auto doc_result) { \ ASSERT_ERROR( doc_result["a"].get_##TYPE(), (ERROR) ); \ return true; \ })) { \