libstdc++
Containers
Collaboration diagram for Containers:

Modules

Classes


Detailed Description

Containers are collections of objects.

A container may hold any type which meets certain requirements, but the type of contained object is chosen at compile time, and all objects in a given container must be of the same type. (Polymorphism is possible by declaring a container of pointers to a base class and then populating it with pointers to instances of derived classes. Variant value types such as the any class from Boost can also be used.

All contained types must be Assignable and CopyConstructible. Specific containers may place additional requirements on the types of their contained objects.

Containers manage memory allocation and deallocation themselves when storing your objects. The objects are destroyed when the container is itself destroyed. Note that if you are storing pointers in a container, delete is not automatically called on the pointers before destroying them.

All containers must meet certain requirements, summarized in tables.

The standard containers are further refined into Sequences and Associative Containers. Unordered Associative Containers.