There are two types of containers in STL:Sequential containerAndAssociated container.
Ordered container: vector, list, deque
Associated containers: map, multimap, set, and Multiset
Both types of containers provide insert () for inserting elements, and erase () deletes elements from the container.
In addition, ordered containers also provide push_back () and pop_back (). The former adds elements to the end of the container, and the latter deletes elements from the end.
For ordered containers, especially vector, end access is fast and inexpensive.
The list and deque methods in the ordered container also provide the start-end access methods push_front () and pop_front ().
Method for accessing elements in a container
1. iterator
Both the sequential container and the associated container provide the member functions begin () and end (), which return the iterator pointing to the start position and end position of the container respectively.
2. Find ()
The associated container also provides the find () member function, which uses keywords to locate an element in the associated container.
3. Vector []
Vector is a dynamic array that supports the subscript index method of the array to access elements.