👌 address comments

This commit is contained in:
Niels Lohmann 2021-01-15 16:54:00 +01:00
parent 1a467a8c4e
commit b0d8628c49
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
2 changed files with 4 additions and 14 deletions

View File

@ -3607,16 +3607,10 @@ class basic_json
// remember array size before resizing // remember array size before resizing
const auto previous_size = m_value.array->size(); const auto previous_size = m_value.array->size();
#endif #endif
m_value.array->resize(idx + 1); m_value.array->resize(idx + 1);
#if JSON_DIAGNOSTICS
// set parent for values added above // set parent for values added above
for (auto i = previous_size; i <= idx; ++i) set_parents(begin() + previous_size, idx + 1 - previous_size);
{
set_parent(m_value.array->operator[](i));
}
#endif
} }
return m_value.array->operator[](idx); return m_value.array->operator[](idx);
@ -5985,6 +5979,7 @@ class basic_json
std::swap(m_value, other.m_value); std::swap(m_value, other.m_value);
set_parents(); set_parents();
other.set_parents();
assert_invariant(); assert_invariant();
} }

View File

@ -20362,16 +20362,10 @@ class basic_json
// remember array size before resizing // remember array size before resizing
const auto previous_size = m_value.array->size(); const auto previous_size = m_value.array->size();
#endif #endif
m_value.array->resize(idx + 1); m_value.array->resize(idx + 1);
#if JSON_DIAGNOSTICS
// set parent for values added above // set parent for values added above
for (auto i = previous_size; i <= idx; ++i) set_parents(begin() + previous_size, idx + 1 - previous_size);
{
set_parent(m_value.array->operator[](i));
}
#endif
} }
return m_value.array->operator[](idx); return m_value.array->operator[](idx);
@ -22740,6 +22734,7 @@ class basic_json
std::swap(m_value, other.m_value); std::swap(m_value, other.m_value);
set_parents(); set_parents();
other.set_parents();
assert_invariant(); assert_invariant();
} }