0001 template <typename T> //删除Quadlist内位置p处的节点,返回其中存放的词条 0002 T Quadlist<T>::remove( QNodePosi<T> p ) { // assert: p为Quadlist中的合法位置 0003 p->pred->succ = p->succ; p->succ->pred = p->pred; _size--;//摘除节点 0004 T e = p->entry; delete p; //备份词条,释放节点 0005 return e; //返回词条 0006 } 0007 0008 template <typename T> int Quadlist<T>::clear() { //清空Quadlist 0009 int oldSize = _size; 0010 while ( 0 < _size ) remove( head->succ ); //逐个删除所有节点 0011 return oldSize; 0012 }