QStack<int> stack;
stack.push(1);
stack.push(2);
stack.push(3);
while (!stack.isEmpty())
cout << stack.pop() << endl;
QStack<QString> stack;
QString operand1;
模拟堆栈的变化,先进后出
QStack() | |
~QStack() | |
T | pop() 从堆栈中移除顶部项并返回它。这个函数假定堆栈不是空的。 |
void | push(const T & t) 将元素t添加到堆栈顶部。This is the same as QVector::append(). |
void | swap(QStack<T> & other) 交换其他与此堆栈。这个操作非常快,而且从来没有失败过。 |
T & | top() 返回对堆栈顶部项目的引用。这个函数假定堆栈不是空的。This is the same as QVector::last(). |
const T & | top() const 重载 |