栈:先进后出
#include<stack>
stack<int> temp;
temp.pop():移除栈顶元素。
temp.push():在栈顶增加元素。
temp.empty():栈为空返回真。
temp.top():返回栈顶元素。
temp.size():返回栈中元素数目。
如果想让stack底层容器为list
stack<int, list<int>> istack;
函数如上正常使用。
栈:先进后出
#include<stack>
stack<int> temp;
temp.pop():移除栈顶元素。
temp.push():在栈顶增加元素。
temp.empty():栈为空返回真。
temp.top():返回栈顶元素。
temp.size():返回栈中元素数目。
如果想让stack底层容器为list
stack<int, list<int>> istack;
函数如上正常使用。
转载于:https://www.cnblogs.com/share-happy-everyday/p/9535401.html