mirror of
https://github.com/nlohmann/json.git
synced 2025-07-28 12:02:00 +03:00
🐛 fix bug in move constructor
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user