I want to delete a node from a boost property tree, but I want to preserve its children and connect them to the parent of the deleted node (i.e. to their grandparent node). Is there an elegant way to achieve this?
相关问题
- Sorting 3 numbers without branching [closed]
- Illegal to have multiple roots (start tag in epilo
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
相关文章
- Creating XML Elements without namespace declaratio
- Class layout in C++: Why are members sometimes ord
- Get Attribute Value From Simple XML Using JQuery /
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
I had to do something similar.
I used an iterator with recursion and copied the child before removing the node and branching it back on a newly created one.
But I guess the full copy of each trees before removing to be quite resources-consuming so you can only do it with relatively small trees and it isn't really elegant.
This might be the most efficient way to move the grandchildren:
Full sample
Live On Coliru
Sample json output: