Esempio n. 1
0
//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;
	}
}
Esempio n. 2
0
 size_type erase_key(const Key& k, const Comparator &comp, allocator_v1)
 {  return this->icont().erase_and_dispose(k, comp, Destroyer(this->node_alloc())); }
Esempio n. 3
0
 icont_iterator erase_range(icont_iterator first, icont_iterator last, allocator_v1)
 {  return this->icont().erase_and_dispose(first, last, Destroyer(this->node_alloc())); }
Esempio n. 4
0
 void clear(allocator_v1)
 {  this->icont().clear_and_dispose(Destroyer(this->node_alloc()));   }
Esempio n. 5
0
//destructor
DecisionTree::~DecisionTree()
{
	vpLeafNodes.clear();
	Destroyer(pRootNode);
	pRootNode = nullptr;
}