Commit 3f97a5d5 authored by Niels's avatar Niels

a conceptual quick fix for #269

parent 15a314ab
...@@ -10002,13 +10002,16 @@ basic_json_parser_63: ...@@ -10002,13 +10002,16 @@ basic_json_parser_63:
// in a second pass, traverse the remaining elements // in a second pass, traverse the remaining elements
// remove my remaining elements // remove my remaining elements
const auto end_index = static_cast<difference_type>(result.size());
while (i < source.size()) while (i < source.size())
{ {
result.push_back(object( // add operations in reverse order to avoid invalid
// indices
result.insert(result.begin() + end_index,
{ {
{"op", "remove"}, {"op", "remove"},
{"path", path + "/" + std::to_string(i)} {"path", path + "/" + std::to_string(i)}
})); });
++i; ++i;
} }
......
...@@ -9312,13 +9312,16 @@ class basic_json ...@@ -9312,13 +9312,16 @@ class basic_json
// in a second pass, traverse the remaining elements // in a second pass, traverse the remaining elements
// remove my remaining elements // remove my remaining elements
const auto end_index = static_cast<difference_type>(result.size());
while (i < source.size()) while (i < source.size())
{ {
result.push_back(object( // add operations in reverse order to avoid invalid
// indices
result.insert(result.begin() + end_index,
{ {
{"op", "remove"}, {"op", "remove"},
{"path", path + "/" + std::to_string(i)} {"path", path + "/" + std::to_string(i)}
})); });
++i; ++i;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment