C++ Containers

Containers can be described as the objects that hold the data of the same type. Containers are used to implement different data structures for example arrays, list, trees, etc.

Following are the containers that give the details of all the containers as well as the header file and the type of iterator associated with them :

Container Description Header file iterator
vector vector is a class that creates a dynamic array allowing insertions and deletions at the back. <vector> Random access
list list is the sequence containers that allow the insertions and deletions from anywhere. <list> Bidirectional
deque deque is the double ended queue that allows the insertion and deletion from both the ends. <deque> Random access
set set is an associate container for storing unique sets. <set> Bidirectional
multiset Multiset is an associate container for storing non- unique sets. <set> Bidirectional
map Map is an associate container for storing unique key-value pairs, i.e. each key is associated with only one value(one to one mapping). <map> Bidirectional
multimap multimap is an associate container for storing key- value pair, and each key can be associated with more than one value. <map> Bidirectional
stack It follows last in first out(LIFO). <stack> No iterator
queue It follows first in first out(FIFO). <queue> No iterator
Priority-queue First element out is always the highest priority element. <queue> No iterator
Posted on by