0001 /****************************************************************************************** 0002 * Data Structures in C++ 0003 * ISBN: 7-302-33064-6 & 7-302-33065-3 & 7-302-29652-2 & 7-302-26883-3 0004 * Junhui DENG, deng@tsinghua.edu.cn 0005 * Computer Science & Technology, Tsinghua University 0006 * Copyright (c) 2003-2019. All rights reserved. 0007 ******************************************************************************************/ 0008 0009 template <typename T> //复制列表中自位置p起的n项(assert: p为合法位置,且至少有n-1个后继节点) 0010 List<T>::List ( ListNodePosi(T) p, int n ) { copyNodes ( p, n ); } 0011 0012 template <typename T> //整体复制列表L 0013 List<T>::List ( List<T> const& L ) { copyNodes ( L.first(), L._size ); } 0014 0015 template <typename T> //复制L中自第r项起的n项(assert: r+n <= L._size) 0016 List<T>::List ( List<T> const& L, int r, int n ) { 0017 ListNodePosi(T) p = L.first(); 0018 while ( 0 < r-- ) p = p->succ; 0019 copyNodes ( p, n ); 0020 }