void SgNode::DeleteBranches() { SgNode* main = LeftMostSon(); while (main) { SgNode* brother = main->RightBrother(); while (brother) { SgNode* nextToDelete = brother->RightBrother(); brother->DeleteSubtree(); delete brother; brother = nextToDelete; } main = main->LeftMostSon(); } }
void SgNode::DeleteTree() { SgNode* root = Root(); root->DeleteSubtree(); delete root; }