🐛 fix bug in move constructor

parent ec0b1798
......@@ -1873,9 +1873,9 @@ class basic_json
{
m_value.array = create<array_t>(cnt, val);
#if JSON_DIAGNOSTICS
for (auto& entry : *m_value.array)
for (auto& element : *m_value.array)
{
entry.m_parent = this;
element.m_parent = this;
}
#endif
assert_invariant();
......@@ -2196,6 +2196,32 @@ class basic_json
other.m_type = value_t::null;
other.m_value = {};
#if JSON_DIAGNOSTICS
switch (m_type)
{
case value_t::array:
{
for (auto& element : *m_value.array)
{
element.m_parent = this;
}
break;
}
case value_t::object:
{
for (auto& element : *m_value.object)
{
element.second.m_parent = this;
}
break;
}
default:
break;
}
#endif
assert_invariant();
}
......
......@@ -18509,9 +18509,9 @@ class basic_json
{
m_value.array = create<array_t>(cnt, val);
#if JSON_DIAGNOSTICS
for (auto& entry : *m_value.array)
for (auto& element : *m_value.array)
{
entry.m_parent = this;
element.m_parent = this;
}
#endif
assert_invariant();
......@@ -18832,6 +18832,32 @@ class basic_json
other.m_type = value_t::null;
other.m_value = {};
#if JSON_DIAGNOSTICS
switch (m_type)
{
case value_t::array:
{
for (auto& element : *m_value.array)
{
element.m_parent = this;
}
break;
}
case value_t::object:
{
for (auto& element : *m_value.object)
{
element.second.m_parent = this;
}
break;
}
default:
break;
}
#endif
assert_invariant();
}
......
......@@ -1280,7 +1280,7 @@ TEST_CASE("JSON patch")
std::ifstream f(filename);
json suite = json::parse(f);
for (const auto test : suite)
for (const auto& test : suite)
{
INFO_WITH_TEMP(test.value("comment", ""));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment