Skip to content

Commit

Permalink
Improve basic_json storage
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Oct 28, 2024
1 parent f9f0f9d commit d1c6881
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions include/jsoncons/basic_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2168,16 +2168,20 @@ namespace jsoncons {
switch (other.storage_kind())
{
case json_storage_kind::long_str:
construct<long_string_storage>(std::move(other.cast<long_string_storage>()));
construct<long_string_storage>(other.cast<long_string_storage>());
other.construct<null_storage>();
break;
case json_storage_kind::byte_str:
construct<byte_string_storage>(std::move(other.cast<byte_string_storage>()));
construct<byte_string_storage>(other.cast<byte_string_storage>());
other.construct<null_storage>();
break;
case json_storage_kind::array:
construct<array_storage>(std::move(other.cast<array_storage>()));
construct<array_storage>(other.cast<array_storage>());
other.construct<null_storage>();
break;
case json_storage_kind::object:
construct<object_storage>(std::move(other.cast<object_storage>()));
construct<object_storage>(other.cast<object_storage>());
other.construct<null_storage>();
break;
default:
JSONCONS_UNREACHABLE();
Expand All @@ -2201,24 +2205,7 @@ namespace jsoncons {
}
else
{
switch (other.storage_kind())
{
case json_storage_kind::long_str:
construct<long_string_storage>(std::move(other.cast<long_string_storage>()), alloc);
break;
case json_storage_kind::byte_str:
construct<byte_string_storage>(std::move(other.cast<byte_string_storage>()), alloc);
break;
case json_storage_kind::array:
construct<array_storage>(std::move(other.cast<array_storage>()), alloc);
break;
case json_storage_kind::object:
construct<object_storage>(std::move(other.cast<object_storage>()), alloc);
break;
default:
JSONCONS_UNREACHABLE();
break;
}
uninitialized_copy_a(other, alloc);
}
}

Expand Down

0 comments on commit d1c6881

Please sign in to comment.