In the c ++ standard template library, there are three types of containers: sequential containers, associated containers, and container adapters. An ordered container is a linear ordered cluster. The underlying implementation relies on linked lists or arrays. An associated container is a non-linear tree structure that stores data in key-value format. These two types are described in the previous two articles, and the third type of container is the container adapter. As the name suggests, an adapter is a mechanism that allows an object to behave in line with the behavior of another object. Container adapter is an interface that enables an existing container type to work in a different abstract type. C ++ STL contains three adapters: stack, queue, and priority priority_queue. The three adapters provided in www.2cto.com STL can be implemented by an ordered container. By default, stack and queue are implemented based on the deque container, while priority_queue is implemented based on the vector container. Of course, when creating an adapter, you can also specify a specific implementation container. When creating an adapter, you can specify a specific sequence container on the second parameter to override the default Implementation of the adapter. Due to the characteristics of the adapter, an adapter cannot be implemented by any sequential container. Stack is characterized by post-import, first-out, so the basic container associated with it can be any sort of ordered container, because these container type structures can provide stack operation requirements, they all provide push_back, pop_back, and back operations. The queue features first-in-first-out, and the adapter requires that the associated basic container must provide the pop_front operation, so it cannot be built on the vector container; the priority_queue adapter of the priority queue requires random access, so it cannot be created on the list container.