0001 template <typename T> void Vector<T>::expand() { //向量空间不足时扩容 0002 if ( _size < _capacity ) return; //尚未满员时,不必扩容 0003 T* oldElem = _elem; copyFrom( oldElem, 0, _capacity ); //容量加倍 0004 delete [] oldElem; //释放原空间 0005 }