Tree::InsertSubnodeBefore
Defined in:
Adds a subnode to an object before a specific subnode in the subnode list.
TSTree.h
Prototype
virtual void InsertSubnodeBefore(Tree<type> *node, Tree<type> *before);
Parameters
node |
A pointer to the subnode to add. |
before |
A pointer to the subnode before which the new subnode is added. |
Description
The InsertSubnodeBefore
function adds the node specified by the node
parameter to an object immediately before the node specified by the before
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 before
parameter is nullptr
, then the node is added to the end of the subnode list. Otherwise, the before
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