Containers

chinmay.sahoo

New member
Containers come in two major families: sequence and associative. Sequence containers (vectors, lists, and deques) are ordered by having a sequence of elements. The vector is the most useful. The deque is a double-ended queue container, conveniently added to at both front and back. The list makes internal insertion and deletion efficient and convenient. Associative containers (sets, multisets, maps, and multimaps) have keys for looking up elements. The set is a container that stores a value according to an ordering relationship. A set contains only unique values. The multiset allows multiple copies of the same item to be stored. The map container is a basic associative array and requires that a comparison operation on the stored elements be defined. The multimap is a generalization of a map that allows nonunique keys. So, one key value may be linked to more than one value.

The two varieties of container share a similar interface

STL Typical Container Interfaces
  1. Constructors, including default and copy constructors
  2. Element access
  3. Element insertion
  4. Element deletion
  5. Destructor
  6. Iterators

Containers are traversed using iterators that are available as templates and optimized for use with STL containers
 
Back
Top