0001 template <typename T> 0002 BinNodePosi<T> NodeCopy( BinNodePosi<T> p, BinNodePosi<T> s ) { 0003 if ( !s ) return NULL; 0004 BinNodePosi<T> t = new BinNode<T>( s->data, p, NULL, NULL, s->height, s->npl, s->color ); 0005 t->lc = NodeCopy( t, s->lc ); 0006 t->rc = NodeCopy( t, s->rc ); 0007 return t; 0008 } 0009 0010 template <typename T> //通过复制来构造二叉树 0011 BinTree<T>::BinTree( BinTree<T> const & s ) { 0012 _size = s.size(); 0013 _root = NodeCopy<T>( NULL, s._root ); 0014 }