C++

C++ [Container 3] Container Adaptors

std::queue, std::stack, std::priority_queue

Posted by Rico's Nerd Cluster on January 29, 2023

std::queue, std::stack, std::priority_queue are NOT sequence containers, instead, they are wrappers around std::deque, and std::vector to provide a restricted interface. (FIFO for queue, LIFO for stack). The common interface we examine are:

  • push, pop
  • top, front
  • No iterators or allow traversals.