C++ Containers

C++ Reference

cppreference.com > Containers

C++ Containers

The C++ Containers (vectors, lists, etc.) are generic vessels capable of holding many different types of data. For example, the following statement creates a vector of integers:
vector<int> v;
Containers can hold standard objects (like the int in the above example) as well as custom objects, as long as the objects in the container meet a few requirements:
  • The object must have a default constructor,
  • an accessible destructor, and
  • an accessible assignment operator.
When describing the functions associated with these various containers, this website defines the word TYPE to be the object type that the container holds. For example, in the above statement, TYPE would be int. Similarily, when referring to containers associated with pairs of data (map for example) key_type and value_type are used to refer to the key and value types for that container.