mirror of
https://github.com/nlohmann/json.git
synced 2026-09-29 11:10:30 +00:00
🐛 fix invariants
This commit is contained in:
@@ -132,6 +132,7 @@ struct external_constructor<value_t::array>
|
||||
{
|
||||
j.m_type = value_t::array;
|
||||
j.m_value = arr;
|
||||
j.set_parent(j, true);
|
||||
j.assert_invariant();
|
||||
}
|
||||
|
||||
@@ -140,6 +141,7 @@ struct external_constructor<value_t::array>
|
||||
{
|
||||
j.m_type = value_t::array;
|
||||
j.m_value = std::move(arr);
|
||||
j.set_parent(j, true);
|
||||
j.assert_invariant();
|
||||
}
|
||||
|
||||
@@ -152,6 +154,7 @@ struct external_constructor<value_t::array>
|
||||
using std::end;
|
||||
j.m_type = value_t::array;
|
||||
j.m_value.array = j.template create<typename BasicJsonType::array_t>(begin(arr), end(arr));
|
||||
j.set_parent(j, true);
|
||||
j.assert_invariant();
|
||||
}
|
||||
|
||||
@@ -164,6 +167,9 @@ struct external_constructor<value_t::array>
|
||||
for (const bool x : arr)
|
||||
{
|
||||
j.m_value.array->push_back(x);
|
||||
#if JSON_DIAGNOSTICS
|
||||
j.m_value.array->back().m_parent = &j;
|
||||
#endif
|
||||
}
|
||||
j.assert_invariant();
|
||||
}
|
||||
@@ -179,6 +185,7 @@ struct external_constructor<value_t::array>
|
||||
{
|
||||
std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin());
|
||||
}
|
||||
j.set_parent(j, true);
|
||||
j.assert_invariant();
|
||||
}
|
||||
};
|
||||
@@ -191,6 +198,7 @@ struct external_constructor<value_t::object>
|
||||
{
|
||||
j.m_type = value_t::object;
|
||||
j.m_value = obj;
|
||||
j.set_parent(j, true);
|
||||
j.assert_invariant();
|
||||
}
|
||||
|
||||
@@ -199,6 +207,7 @@ struct external_constructor<value_t::object>
|
||||
{
|
||||
j.m_type = value_t::object;
|
||||
j.m_value = std::move(obj);
|
||||
j.set_parent(j, true);
|
||||
j.assert_invariant();
|
||||
}
|
||||
|
||||
@@ -211,6 +220,7 @@ struct external_constructor<value_t::object>
|
||||
|
||||
j.m_type = value_t::object;
|
||||
j.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(obj), end(obj));
|
||||
j.set_parent(j, true);
|
||||
j.assert_invariant();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user