给定以下代码:
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
方法。那我怎样才能得到元素(在前面)?
问候