我需要执行一个for循环直到队列为空 我的代码
queue<string> q;
for(int i=0;i<q.size(),i++)
{
// some operation goes here
// some datas are added to queue
}
最佳答案
while (!q.empty())
{
std::string str = q.front();
// TODO: do something with str.
q.pop();
}
关于c++ - 如何在C++中执行for循环直到队列为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3879055/