小编Ale*_*ane的帖子

不同容器上的 std::stack 实现有什么实际区别?

当实施一个 std::stack

有几个选项,例如:

   // stack with default underlying deque
   std::stack< int > intDequeStack;   

   // stack with underlying vector
   std::stack< int, std::vector< int > > intVectorStack;

   // stack with underlying list
   std::stack< int, std::list< int > > intListStack;
Run Code Online (Sandbox Code Playgroud)

std::stack 当我从中得到的只是相同的操作“push、pop 和 top”时,我从在不同的容器上定义有什么优点和缺点?

换句话说:一堆双端队列和一堆向量和一堆列表之间有什么区别,为什么我要选择双端队列以外的任何东西?

c++ containers stl stdstack

3
推荐指数
1
解决办法
140
查看次数

标签 统计

c++ ×1

containers ×1

stdstack ×1

stl ×1