给出以下代码:
void World::extractStates(deque<string> myDeque)
{
unsigned int i = 0;
string current; // current extracted string
while (i < myDeque.size()) // run on the entire vector and extract all the elements
{
current = myDeque.pop_front(); // doesn't work
// do more stuff
}
}
我想在每次迭代中提取前面的元素,但是
pop_front()
是一个void
方法。那么我怎样才能获得元素(在前面)呢?