Engineering Details 4
typename BST_BASE<T,P>::Node* BST_BASE<T,P>::RClone(const BST_BASE<T,P>::Node* n)
// returns a pointer to a deep copy of n
{
if (n == nullptr)
return nullptr;
typename BST_BASE<T,P>::Node* newN = NewNode (n->value_, n->flags_);
if (n->HasLeftChild())
newN->lchild_ = BST_BASE<T,P>::RClone(n->lchild_);
else
newN->lchild_ = nullptr;
if (n->HasRightChild())
newN->rchild_ = BST_BASE<T,P>::RClone(n->rchild_);
else
newN->rchild_ = nullptr;
return newN;
} // end BST_BASE<T,P>::RClone() */