Object objects[theCapacity]; iterator insert(int pos,const Object& x) { Object* oldArray=objects; theSize++; int i=0; if(theCapacity<theSize) theCapacity=theSize; objects=new Object[theCapacity]; while(i!=pos) { objects[i]= oldArray[i]; i++; } objects[pos]=x; for(int k=pos;k<theSize;k++) objects[k+1]=oldArray[k]; delete[] oldArray; return &objects[pos]; }
原文:http://www.cnblogs.com/CClarence/p/5146852.html