[container.requirements.pre]

# 23 Containers library [[containers]](./#containers)

## 23.2 Requirements [[container.requirements]](container.requirements#pre)

### 23.2.1 Preamble [container.requirements.pre]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L40)

Containers are objects that store other objects[.](#1.sentence-1)

They control allocation and deallocation of these objects
through constructors, destructors, insert and erase operations[.](#1.sentence-2)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L45)

All of the complexity requirements in this Clause are stated solely
in terms of the number of operations on the contained objects[.](#2.sentence-1)

[*Example [1](#example-1)*:

The copy constructor of typevector<vector<int>> has linear complexity,
even though the complexity of copying each containedvector<int> is itself linear[.](#2.sentence-2)

â *end example*]

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L57)

Allocator-aware containers ([[container.alloc.reqmts]](container.alloc.reqmts "23.2.2.5 Allocator-aware containers"))
other than basic_string construct elements using the functionallocator_traits<allocator_type>​::​rebind_traits<U>​::​​construct and destroy elements using the functionallocator_traits<allocator_type>​::​rebind_traits<U>​::​​destroy ([[allocator.traits.members]](allocator.traits.members "20.2.9.3 Static member functions")),
where U is either allocator_type​::​value_type or
an internal type used by the container[.](#3.sentence-1)

These functions are called only for the
container's element type, not for internal types used by the container[.](#3.sentence-2)

[*Note [1](#note-1)*:

This
means, for example, that a node-based container would need to construct nodes containing
aligned buffers and call construct to place the element into the buffer[.](#3.sentence-3)

â *end note*]
