这是我当前的代码。有没有更好的方法在 C++ 中做同样的事情?
{
// create more room in array
Point *temp = new Point[pointList.getSize()*ENLARGE_TIMES];
memcpy(temp,pointList._pointList,sizeof(Point)*pointList.getSize());
pointList.~PointList();
pointList._pointList = temp;
pointList.setSize(pointList.getSize()*ENLARGE_TIMES);
pointList._pointList[iterator] = point;
iterator++;
pointsCounter++;
continue;
}
编辑:不能使用矢量