1
0
mirror of https://github.com/nlohmann/json synced 2024-11-29 23:21:04 +00:00

🔨 cleanup

This commit is contained in:
Niels Lohmann 2018-03-17 23:31:18 +01:00
parent 606a25195f
commit 375b05a17d
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
2 changed files with 32 additions and 20 deletions

View File

@ -277,18 +277,24 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
}
else
{
assert(ref_stack.back()->is_array() or ref_stack.back()->is_object());
if (ref_stack.back()->is_array())
switch (ref_stack.back()->m_type)
{
case value_t::array:
{
ref_stack.back()->m_value.array->push_back(BasicJsonType(std::forward<Value>(v)));
return &(ref_stack.back()->m_value.array->back());
}
else
case value_t::object:
{
assert(object_element);
*object_element = BasicJsonType(std::forward<Value>(v));
return object_element;
}
default:
assert(false); // LCOV_EXCL_LINE
}
}
}

View File

@ -3413,18 +3413,24 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
}
else
{
assert(ref_stack.back()->is_array() or ref_stack.back()->is_object());
if (ref_stack.back()->is_array())
switch (ref_stack.back()->m_type)
{
case value_t::array:
{
ref_stack.back()->m_value.array->push_back(BasicJsonType(std::forward<Value>(v)));
return &(ref_stack.back()->m_value.array->back());
}
else
case value_t::object:
{
assert(object_element);
*object_element = BasicJsonType(std::forward<Value>(v));
return object_element;
}
default:
assert(false); // LCOV_EXCL_LINE
}
}
}