0001 template <typename T> //将e作为秩为r元素插入 0002 Rank Vector<T>::insert ( Rank r, T const& e ) { //assert: 0 <= r <= size 0003 expand(); //若有必要,扩容 0004 for ( int i = _size; i > r; i-- ) _elem[i] = _elem[i-1]; //自后向前,后继元素顺次后移一个单元 0005 _elem[r] = e; _size++; //置入新元素并更新容量 0006 return r; //返回秩 0007 }