stack,queue

  • Container adaptor: Almost all functions are implemented by calling the underlying deque; of course, it does not have to be deque, as long as the selected container can provide the interface functions required by stack and deque.
stack和queue可使用list,deque作底层容器;
queue不能使用vector,因为vector不提供pop_front,实际queue只要不使用pop,也可以用vector作底层容器,因为对于这些模板class来说,只有调用到对应的成员函数,编译器才会检查该调用是否合法;
  • Both stack and deque do not allow traversal, so no iterators are provided: because they have to maintain the characteristics of first-in-last-out and last-in-first-out respectively;

Guess you like

Origin blog.csdn.net/jiuri1005/article/details/114588549