0001 template <typename T> void List<T>::init() { //列表初始化,在创建列表对象时统一调用 0002 header = new ListNode<T>; //创建头哨兵节点 0003 trailer = new ListNode<T>; //创建尾哨兵节点 0004 header->succ = trailer; header->pred = NULL; 0005 trailer->pred = header; trailer->succ = NULL; 0006 _size = 0; //记录规模 0007 }