因为end()指向容器最后一个元素后面的位置。如果要用end(),要这样:
vector<object>::const_iterator i = vectorOfObjects.end();
i--;
cout << *i << endl; // Prints the last element of the container
因为end()指向容器最后一个元素后面的位置。如果要用end(),要这样:
vector<object>::const_iterator i = vectorOfObjects.end();
i--;
cout << *i << endl; // Prints the last element of the container