Moving a node from one list to another?
I'm implementing a multi-branch tree with such a data structure.
Sometimes I have to merge the children, just like this.
typedef struct TreeNodeStruct
But I soon found that the push_back() and pop_back() operations become too slow when the merging repeats many times. (Maybe these frequent operation is making the memory a mess?) So I'm wondering whether there is a way to "move" a node directly from one list to another so we do not have to call new() and delete() on memory frequently. Is STL providing such a way to do that? Or can we implement it ourselves?
// merge the last child into the first child