我怎样才能使它成为 LIFO-> 后进先出队列?有什么简单的方法可以做到这一点?这是一个先进先出队列的 FIFO-> fifo。
using namespace std;
int main(){
queue<string> q;
cout << "Pushing one two three four\n";
q.push("one");
q.push("two");
q.push("three");
q.push("four");
cout << "Now, retrieve those values in FIFO order.\n";
while(!q.empty()) {
cout << "Popping ";
cout << q.front() << "\n";
q.pop();
}
cout << endl;
return 0;
}