Tree::InsertSubnodeAfter
Defined in:
Adds a subnode to an object after a specific subnode in the subnode list.
TSTree.h
Prototype
virtual void InsertSubnodeAfter(Tree<type> *node, Tree<type> *after);
Parameters
node |
A pointer to the subnode to add. |
after |
A pointer to the subnode after which the new subnode is added. |
Description
The InsertSubnodeAfter
function adds the node specified by the node
parameter to an object immediately after the node specified by the after
parameter in the list of subnodes for that object. If the node is already a subnode of the object, then it is moved to the new position in the subnode list. If the after
parameter is nullptr
, then the node is added to the beginning of the subnode list. Otherwise, the after
parameter must specify a node that is already a subnode of the tree for which this function is called.If the node being added is already a member of a different tree of the same type, then it is first removed from that tree. If the node has subnodes itself, then those subnodes are carried with the node into the new tree.
See Also