From 0989a3c00cd09325481a45fd0047789676b50ab1 Mon Sep 17 00:00:00 2001 From: Anthony VH Date: Sat, 11 Sep 2021 00:23:33 +0200 Subject: [PATCH] Added fix for #3007 to update(const_iterator, const_iterator) as well. --- include/nlohmann/json.hpp | 3 +++ single_include/nlohmann/json.hpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 8e2de8375..053be8f74 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -6072,6 +6072,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec for (auto it = first; it != last; ++it) { m_value.object->operator[](it.key()) = it.value(); +#if JSON_DIAGNOSTICS + m_value.object->operator[](it.key()).m_parent = this; +#endif } } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 4bae31ac9..803a83c39 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -23477,6 +23477,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec for (auto it = first; it != last; ++it) { m_value.object->operator[](it.key()) = it.value(); +#if JSON_DIAGNOSTICS + m_value.object->operator[](it.key()).m_parent = this; +#endif } }