# C++: Data Structures: Logical Structures - Containers

## Logical Grouping - Containers

Everything is built upon the basic hardware-oriented types and groupings. These features are generally the only ones supported by directly by basic mainstream programming language features. However, libraries in C++ and Java provide more abstract ways to group data implemented as classes. These more logical structures are often called containers or collections, and include vectors, lists, sets, maps, ....
To generalize these classes to all types, they are implemented by means of templates, hence the common name for this library is the Standard Template Library (STL).

## Example - vector

An example of changing from a physical, hardware-oriented structure to a logical structure is moving from an array to a vector. This logical container to group data together is not implemented directly in the C++ language, but with a predefined class library, accessed with

       #include <vector>

The `vector` template class allows an array-like structure that expands automatically as necessary when the user stores more data in it. The vector is a very nice solution to the problems of fixed array sizes:

- The programmer can ignore the size because the underlying array will be expanded as needed.