std::stack
is an adapter for other containers, by default it uses std::deque
but you can pass other containers as a template argument. For example a simple benchmark of using std::vector
vs. std::deque
as the underlying container with some pushes and pops
https://quick-bench.com/q/3fPcSphHjnWh5uq9ZYvhBvMjl8A