//function for destructing nodes recursively void DecisionTree::Destroyer(Node* pSubRootNode) { if (IsLeafNode(pSubRootNode)) { delete pSubRootNode; pSubRootNode = nullptr; return; } else { if (pSubRootNode->plChild) { Destroyer(pSubRootNode->plChild); } if (pSubRootNode->prChild) { Destroyer(pSubRootNode->prChild); } delete pSubRootNode; pSubRootNode = nullptr; } }
size_type erase_key(const Key& k, const Comparator &comp, allocator_v1) { return this->icont().erase_and_dispose(k, comp, Destroyer(this->node_alloc())); }
icont_iterator erase_range(icont_iterator first, icont_iterator last, allocator_v1) { return this->icont().erase_and_dispose(first, last, Destroyer(this->node_alloc())); }
void clear(allocator_v1) { this->icont().clear_and_dispose(Destroyer(this->node_alloc())); }
//destructor DecisionTree::~DecisionTree() { vpLeafNodes.clear(); Destroyer(pRootNode); pRootNode = nullptr; }