Containers in C++ STL (Standard Template Library)

A container is a holder object that stores a collection of other objects (its elements). They are implemented as class templates, which allows a great flexibility in the types supported as elements.

The container manages the storage space for its elements and provides member functions to access them, either directly or through iterators (reference objects with similar properties to pointers).

Sequence containers

Sequence containers implement data structures which can be accessed sequentially.

Associative containers

Associative containers implement sorted data structures that can be quickly searched (O(log n) complexity).

Unordered associative containers

Unordered associative containers implement unsorted (hashed) data structures that can be quickly searched (O(1) amortized, O(n) worst-case complexity).

Container adaptors

Container adaptors provide a different interface for sequential containers.

Flowchart of Adaptive Containers and Unordered Containers

Flowchart of Sequence conatiners and ordered containers

More Useful Links

Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Improved By : AnkurPaul

Article Tags :
Practice Tags :