void Map<Key,Value>::recCopy(Node<Key,Value> &n){ if(n==nullptr) return; recCopy(*(n.getLeft())); bst.insert(new std::pair<Key, Value>(n.getKey(), n.getValue())); recCopy(*(n.getRight())); }
areaTreeNode * AreaTree::recCopy( const areaTreeNode * at ) { if( at == NULL ) return NULL; areaTreeNode * node = new areaTreeNode(at->areaID, at->area ); node->left = recCopy( at->left ); node->right = recCopy( at->right ); return node; }
Map<Key, Value>::Map(const Map<Key, Value>& m){ BST<Key, Value> copy = m.bst; if(map == this) return; if(bst != nullptr) delete bst; bst = new BST<Key,Value>(); recCopy(*((m.bst)->root)); }
AreaTree::AreaTree( const AreaTree & at ) { root = recCopy( at.root ); }