Loading README.md +1 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ include(FetchContent) FetchContent_Declare(json GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent GIT_TAG v3.10.0) GIT_TAG v3.10.1) FetchContent_GetProperties(json) if(NOT json_POPULATED) Loading include/nlohmann/json.hpp +40 −5 Original line number Diff line number Diff line /* __ _____ _____ _____ __| | __| | | | JSON for Modern C++ | | |__ | | | | | | version 3.10.0 | | |__ | | | | | | version 3.10.1 |_____|_____|_____|_|___| https://github.com/nlohmann/json Licensed under the MIT License <http://opensource.org/licenses/MIT>. Loading Loading @@ -32,7 +32,7 @@ SOFTWARE. #define NLOHMANN_JSON_VERSION_MAJOR 3 #define NLOHMANN_JSON_VERSION_MINOR 10 #define NLOHMANN_JSON_VERSION_PATCH 0 #define NLOHMANN_JSON_VERSION_PATCH 1 #include <algorithm> // all_of, find, for_each #include <cstddef> // nullptr_t, ptrdiff_t, size_t Loading Loading @@ -3845,6 +3845,24 @@ struct is_constructible_tuple : std::false_type {}; template<typename T1, typename... Args> struct is_constructible_tuple<T1, std::tuple<Args...>> : conjunction<is_constructible<T1, Args>...> {}; // a naive helper to check if a type is an ordered_map (exploits the fact that // ordered_map inherits capacity() from std::vector) template <typename T> struct is_ordered_map { using one = char; struct two { char x[2]; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) }; template <typename C> static one test( decltype(&C::capacity) ) ; template <typename C> static two test(...); enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg) }; // to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324) template < typename T, typename U, enable_if_t < !std::is_same<T, U>::value, int > = 0 > T conditional_static_cast(U value) Loading Loading @@ -4602,7 +4620,7 @@ struct external_constructor<value_t::binary> { j.m_value.destroy(j.m_type); j.m_type = value_t::binary; j.m_value = typename BasicJsonType::binary_t(std::move(b));; j.m_value = typename BasicJsonType::binary_t(std::move(b)); j.assert_invariant(); } }; Loading Loading @@ -5169,6 +5187,8 @@ class byte_container_with_subtype : public BinaryType // #include <nlohmann/detail/macro_scope.hpp> // #include <nlohmann/detail/value_t.hpp> namespace nlohmann { Loading Loading @@ -13615,7 +13635,7 @@ class binary_writer case value_t::discarded: default: { JSON_THROW(type_error::create(317, "to serialize to BSON, top-level type must be object, but is " + std::string(j.type_name()), j));; JSON_THROW(type_error::create(317, "to serialize to BSON, top-level type must be object, but is " + std::string(j.type_name()), j)); } } } Loading Loading @@ -18446,7 +18466,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec object = nullptr; // silence warning, see #821 if (JSON_HEDLEY_UNLIKELY(t == value_t::null)) { JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.10.0", basic_json())); // LCOV_EXCL_LINE JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.10.1", basic_json())); // LCOV_EXCL_LINE } break; } Loading Loading @@ -18717,6 +18737,21 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec } } // ordered_json uses a vector internally, so pointers could have // been invalidated; see https://github.com/nlohmann/json/issues/2962 #ifdef JSON_HEDLEY_MSVC_VERSION #pragma warning(push ) #pragma warning(disable : 4127) // ignore warning to replace if with if constexpr #endif if (detail::is_ordered_map<object_t>::value) { set_parents(); return j; } #ifdef JSON_HEDLEY_MSVC_VERSION #pragma warning( pop ) #endif j.m_parent = this; #else static_cast<void>(j); Loading
README.md +1 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ include(FetchContent) FetchContent_Declare(json GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent GIT_TAG v3.10.0) GIT_TAG v3.10.1) FetchContent_GetProperties(json) if(NOT json_POPULATED) Loading
include/nlohmann/json.hpp +40 −5 Original line number Diff line number Diff line /* __ _____ _____ _____ __| | __| | | | JSON for Modern C++ | | |__ | | | | | | version 3.10.0 | | |__ | | | | | | version 3.10.1 |_____|_____|_____|_|___| https://github.com/nlohmann/json Licensed under the MIT License <http://opensource.org/licenses/MIT>. Loading Loading @@ -32,7 +32,7 @@ SOFTWARE. #define NLOHMANN_JSON_VERSION_MAJOR 3 #define NLOHMANN_JSON_VERSION_MINOR 10 #define NLOHMANN_JSON_VERSION_PATCH 0 #define NLOHMANN_JSON_VERSION_PATCH 1 #include <algorithm> // all_of, find, for_each #include <cstddef> // nullptr_t, ptrdiff_t, size_t Loading Loading @@ -3845,6 +3845,24 @@ struct is_constructible_tuple : std::false_type {}; template<typename T1, typename... Args> struct is_constructible_tuple<T1, std::tuple<Args...>> : conjunction<is_constructible<T1, Args>...> {}; // a naive helper to check if a type is an ordered_map (exploits the fact that // ordered_map inherits capacity() from std::vector) template <typename T> struct is_ordered_map { using one = char; struct two { char x[2]; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) }; template <typename C> static one test( decltype(&C::capacity) ) ; template <typename C> static two test(...); enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg) }; // to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324) template < typename T, typename U, enable_if_t < !std::is_same<T, U>::value, int > = 0 > T conditional_static_cast(U value) Loading Loading @@ -4602,7 +4620,7 @@ struct external_constructor<value_t::binary> { j.m_value.destroy(j.m_type); j.m_type = value_t::binary; j.m_value = typename BasicJsonType::binary_t(std::move(b));; j.m_value = typename BasicJsonType::binary_t(std::move(b)); j.assert_invariant(); } }; Loading Loading @@ -5169,6 +5187,8 @@ class byte_container_with_subtype : public BinaryType // #include <nlohmann/detail/macro_scope.hpp> // #include <nlohmann/detail/value_t.hpp> namespace nlohmann { Loading Loading @@ -13615,7 +13635,7 @@ class binary_writer case value_t::discarded: default: { JSON_THROW(type_error::create(317, "to serialize to BSON, top-level type must be object, but is " + std::string(j.type_name()), j));; JSON_THROW(type_error::create(317, "to serialize to BSON, top-level type must be object, but is " + std::string(j.type_name()), j)); } } } Loading Loading @@ -18446,7 +18466,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec object = nullptr; // silence warning, see #821 if (JSON_HEDLEY_UNLIKELY(t == value_t::null)) { JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.10.0", basic_json())); // LCOV_EXCL_LINE JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.10.1", basic_json())); // LCOV_EXCL_LINE } break; } Loading Loading @@ -18717,6 +18737,21 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec } } // ordered_json uses a vector internally, so pointers could have // been invalidated; see https://github.com/nlohmann/json/issues/2962 #ifdef JSON_HEDLEY_MSVC_VERSION #pragma warning(push ) #pragma warning(disable : 4127) // ignore warning to replace if with if constexpr #endif if (detail::is_ordered_map<object_t>::value) { set_parents(); return j; } #ifdef JSON_HEDLEY_MSVC_VERSION #pragma warning( pop ) #endif j.m_parent = this; #else static_cast<void>(j);