mirror of
https://github.com/nlohmann/json.git
synced 2025-06-13 13:29:34 +08:00
👌 fix move constructor and move assignment
This commit is contained in:
parent
0617bd248d
commit
04a0a07159
@ -2185,9 +2185,6 @@ class basic_json
|
|||||||
basic_json(basic_json&& other) noexcept
|
basic_json(basic_json&& other) noexcept
|
||||||
: m_type(std::move(other.m_type)),
|
: m_type(std::move(other.m_type)),
|
||||||
m_value(std::move(other.m_value))
|
m_value(std::move(other.m_value))
|
||||||
#if JSON_DIAGNOSTICS
|
|
||||||
, m_parent(other.m_parent)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// check that passed value is valid
|
// check that passed value is valid
|
||||||
other.assert_invariant();
|
other.assert_invariant();
|
||||||
@ -2261,9 +2258,6 @@ class basic_json
|
|||||||
using std::swap;
|
using std::swap;
|
||||||
swap(m_type, other.m_type);
|
swap(m_type, other.m_type);
|
||||||
swap(m_value, other.m_value);
|
swap(m_value, other.m_value);
|
||||||
#if JSON_DIAGNOSTICS
|
|
||||||
m_parent = other.m_parent;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
assert_invariant();
|
assert_invariant();
|
||||||
return *this;
|
return *this;
|
||||||
@ -3659,13 +3653,6 @@ class basic_json
|
|||||||
// fill up array with null values if given idx is outside range
|
// fill up array with null values if given idx is outside range
|
||||||
if (idx >= m_value.array->size())
|
if (idx >= m_value.array->size())
|
||||||
{
|
{
|
||||||
#if JSON_DIAGNOSTICS
|
|
||||||
// remember array size before resizing
|
|
||||||
const auto previous_size = m_value.array->size();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_value.array->resize(idx + 1);
|
|
||||||
|
|
||||||
#if JSON_DIAGNOSTICS
|
#if JSON_DIAGNOSTICS
|
||||||
// set parent for values added above
|
// set parent for values added above
|
||||||
for (auto i = previous_size; i <= idx; ++i)
|
for (auto i = previous_size; i <= idx; ++i)
|
||||||
|
@ -18821,9 +18821,6 @@ class basic_json
|
|||||||
basic_json(basic_json&& other) noexcept
|
basic_json(basic_json&& other) noexcept
|
||||||
: m_type(std::move(other.m_type)),
|
: m_type(std::move(other.m_type)),
|
||||||
m_value(std::move(other.m_value))
|
m_value(std::move(other.m_value))
|
||||||
#if JSON_DIAGNOSTICS
|
|
||||||
, m_parent(other.m_parent)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// check that passed value is valid
|
// check that passed value is valid
|
||||||
other.assert_invariant();
|
other.assert_invariant();
|
||||||
@ -18897,9 +18894,6 @@ class basic_json
|
|||||||
using std::swap;
|
using std::swap;
|
||||||
swap(m_type, other.m_type);
|
swap(m_type, other.m_type);
|
||||||
swap(m_value, other.m_value);
|
swap(m_value, other.m_value);
|
||||||
#if JSON_DIAGNOSTICS
|
|
||||||
m_parent = other.m_parent;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
assert_invariant();
|
assert_invariant();
|
||||||
return *this;
|
return *this;
|
||||||
|
Loading…
Reference in New Issue
Block a user