栈的stl


    stack<int>  s;
    创建一个空的堆栈对象 s 
    stack<int, list<int> >   s1;
    stack<int, list<int> >   s2(s1);

   利用 s1 ,创建一个以双向链表为底层容器的空堆栈对象 s2 。

c++ stl栈stack的头文件为

#include <stack> 

empty() 堆栈为空则返回真

pop() 移除栈顶元素

push() 在栈顶增加元素

size() 返回栈中元素数目

top() 返回栈顶元素

猜你喜欢

转载自blog.csdn.net/xigongdali/article/details/81878981
STL
今日推荐